fix configuration support for package gcmd

This commit is contained in:
John Guo
2022-01-24 10:32:19 +08:00
parent 6e1c76efe6
commit 43f1354e79
2 changed files with 3 additions and 3 deletions

View File

@ -157,7 +157,7 @@ func (c *Command) reParse(ctx context.Context, parser *Parser) (*Parser, error)
return nil, err
}
configMap := value.Map()
for optionName, _ := range parser.passedOptions {
for optionName, _ := range parser.supportedOptions {
// The command line has the high priority.
if parser.GetOpt(optionName) != nil {
continue

View File

@ -26,8 +26,8 @@ type Parser struct {
strict bool // Whether stops parsing and returns error if invalid option passed.
parsedArgs []string // As name described.
parsedOptions map[string]string // As name described.
passedOptions map[string]bool // User passed supported options.
supportedOptions map[string]bool // Option [OptionName:WhetherNeedArgument].
passedOptions map[string]bool // User passed supported options, like: map[string]bool{"name,n":true}
supportedOptions map[string]bool // Option [OptionName:WhetherNeedArgument], like: map[string]bool{"name":true, "n":true}
commandFuncMap map[string]func() // Command function map for function handler.
}