CLI that prints const declarations in a Go file

goprintconst

If you use Go constants as the source of truth in your build, you might end up reading their values like this:

> grep -e "MySpecial.*=.*" "foo/bar.go"
    MySpecial    = "value"

This operation can be error-prone: The regular expression might be incorrect, commands like grep or cut might be unavailable. By walking the Go abstract syntax tree (AST) to find constants, goprintconst makes the operation reliable.

Use

All constants (default):

> goprintconst --path foo/bar.go
MySpecial="value"
AnotherSpecial="foo"
ThirdSpecial="bar"

One constant:

> goprintconst --path foo/bar.go --names MySpecial
MySpecial="value"

Two constants:

> goprintconst --path foo/bar.go --names MySpecial --names AnotherSpecial
MySpecial="value"
AnotherSpecial="foo"

Install

go install github.com/dlipovetsky/goprintconst
Similar Resources

✏️ CLI tool to split a file into smaller sub-files

filesplit CLI tool to split a file into smaller sub-files Build $ go build Usage filesplit [mode] [-F, --file] [-N, --number] Examples # Split foo.txt

Apr 20, 2022

dots is CLI tool to build, version and publish config file bundles.

dots-cli dots is CLI tool to build, version and publish config file bundles. TODO (shared): Writing comprehensive documentation Designing landing page

Aug 24, 2022

kcon is a simple CLI tool to switch the context of your Kubeconfig file.

kcon kcon is a simple CLI tool to switch the context of your Kubeconfig file. Scope The code published here is educational only. Usage Usage of kcon:

Oct 14, 2021

A simple CLI app to take notes daily on markdown file

A simple CLI app to take notes daily on markdown file

A simple CLI app to take notes daily on markdown file

Jul 29, 2022

License-cli - simple LICENSE file generator

📝 license-cli simple LICENSE file generator 2022-01-04.12-28-26.mp4 Install / U

Jun 2, 2022

A CLI tool to find the absolute path of any folder in your local file system.

Table of Contents What is this? How to use this Examples of usage How to compile it What am I looking at It's a CLI tool that I made for finding the a

Jan 15, 2022

Elegant CLI wrapper for kubeseal CLI

Overview This is a wrapper CLI ofkubeseal CLI, specifically the raw mode. If you just need to encrypt your secret on RAW mode, this CLI will be the ea

Jan 8, 2022

CLI to run a docker image with R. CLI built using cobra library in go.

CLI  to run a docker image with R. CLI built using cobra library in go.

BlueBeak Installation Guide Task 1: Building the CLI The directory structure looks like Fastest process: 1)cd into bbtools 2)cd into bbtools/bin 3)I h

Dec 20, 2021

A wrapper of aliyun-cli subcommand alidns, run aliyun-cli in Declarative mode.

aliyun-dns A wrapper of aliyun-cli subcommand alidns, run aliyun-cli in Declarative mode. Installation Install aliyun-cli. Usage $ aliyun-dns -h A wra

Dec 21, 2021
A dead simple CLI tool that prints the next semantic version based on the last tag of your git repository

nextver A dead simple CLI tool that prints the next semantic version based on the last tag of your git repository. Install go install github.com/junk1

Sep 29, 2022
Go-file-downloader-ftctl - A file downloader cli built using golang. Makes use of cobra for building the cli and go concurrent feature to download files.

ftctl This is a file downloader cli written in Golang which uses the concurrent feature of go to download files. The cli is built using cobra. How to

Jan 2, 2022
This is a command that simply prints "ok" onto your screen whenever you run the "ok" command
This is a command that simply prints

ok This is a command that simply prints "ok" onto your screen whenever you run the ok command Installation (Linux) Download the latest release and sud

Sep 16, 2022
Gets joke from icanhazdadjoke.com, prints it

hakjoke Gets joke from icanhazdadjoke.com, prints it Installation go get -u github.com/hakluke/hakjoke Usage Run command. Get joke. ~$ hakjoke Why di

Jul 21, 2022
Go cmd utility that prints its command line arguments using strings.Join

Results This is an exercise of the book The Go Programming Language, by Alan A. A. Donovan and Brian Kernighan. Comparison between different versions

Dec 18, 2021
Go cmd util that prints cmd-line args with their index

echoidx This is an exercise of the book The Go Programming Language, by Alan A.

Dec 18, 2021
Project-2 - Create a project that calls service created above, pass text and prints JSON output returned from the service

Project Assignment Steps to run the project: First Download the repo present her

Jan 27, 2022
CLI filters the contents of the csv file according to the filters from the another file.

filtercsv CLI filters the contents of the csv file according to the filters from the another file. Made to process big files by a lots of filters. By

Dec 2, 2021
This command line converts .webarchive file to resources embed .html file

webarchive-to-singlefile This command line converts Safari's .webarchive file to complete .html. Notice Only tested on MacOS. Google Chrome required.

Dec 30, 2022