Documentation ¶
Overview ¶
Package command provides console operations, like options/arguments reading.
Index ¶
- func ContainsOpt(name string) bool
- func GetArg(index int, def ...string) string
- func GetArgAll() []string
- func GetOpt(name string, def ...string) string
- func GetOptAll() map[string]string
- func GetOptWithEnv(key string, def ...string) string
- func Init(args ...string)
- func ParseUsingDefaultAlgorithm(args ...string) (parsedArgs []string, parsedOptions map[string]string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsOpt ¶
ContainsOpt checks whether option named `name` exist in the arguments.
func GetOpt ¶
GetOpt returns the option value named `name`.
func GetOptWithEnv ¶
GetOptWithEnv returns the command line argument of the specified `key`. If the argument does not exist, then it returns the environment variable with specified `key`. It returns the default value `def` if none of them exists.
Fetching Rules: 1. Command line arguments are in lowercase format, eg: gf.package.variable; 2. Environment arguments are in uppercase format, eg: GF_PACKAGE_VARIABLE;
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.