replace char <xxx> to ;add GetWithEnv/GetWithCmd fuctions for package gcfg

This commit is contained in:
John Guo
2021-10-21 18:22:47 +08:00
parent 6bde7c61b4
commit fa5499373a
124 changed files with 930 additions and 827 deletions

View File

@ -107,8 +107,8 @@ func GetArgAll() []string {
// It returns the default value `def` if none of them exists.
//
// Fetching Rules:
// 1. Command line arguments are in lowercase format, eg: gf.<package name>.<variable name>;
// 2. Environment arguments are in uppercase format, eg: GF_<package name>_<variable name>
// 1. Command line arguments are in lowercase format, eg: gf.package.variable;
// 2. Environment arguments are in uppercase format, eg: GF_PACKAGE_VARIABLE
func GetOptWithEnv(key string, def ...string) string {
cmdKey := strings.ToLower(strings.Replace(key, "_", ".", -1))
if ContainsOpt(cmdKey) {