modulepackage
0.0.0-20200109091749-0640b79d6af4
Repository: https://github.com/bygui86/go-cli.git
Documentation: pkg.go.dev
# README
Go CLI sample project
Info
Precedence
The precedence for flag value sources is as follows (highest to lowest):
- Command line flag value from user
- Environment variable from user (if specified)
- Configuration file (if specified)
[FilePath]
- Environment variable (if specified)
[EnvVar]
- Default defined on the flag
[Value]
Autocompletion
zsh example
go build examples/bash-completion.go
PROG=bash-completion source <(bash-completion autocompletion zsh)
bash-completion
# now play with tab
BASH
Source the autocomplete-scripts/bash_autocomplete
file in your .bashrc
or .bash_profile
file.
go build .
source <(go-cli autocompletion bash)
go-cli
# now play with tab
ZSH
Source the autocomplete-scripts/zsh_autocomplete
file in your .zshrc
file while setting the PROG
variable to the name of your program.
go build .
PROG=go-cli source <(go-cli autocompletion zsh)
go-cli
# now play with tab
Links
Config
- https://medium.com/@felipedutratine/manage-config-in-golang-to-get-variables-from-file-and-env-variables-33d876887152
- https://github.com/Tkanos/gonfig
- https://github.com/spf13/viper
Collaterals
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author