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]
zsh example
go build examples/bash-completion.go
PROG=bash-completion source <(bash-completion autocompletion zsh)
bash-completion
# now play with tab
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
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