diff --git a/os/gcmd/gcmd_command_run.go b/os/gcmd/gcmd_command_run.go index 9669af81d..845900fa8 100644 --- a/os/gcmd/gcmd_command_run.go +++ b/os/gcmd/gcmd_command_run.go @@ -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 diff --git a/os/gcmd/gcmd_parser.go b/os/gcmd/gcmd_parser.go index ea59b7cbb..35aa4ae82 100644 --- a/os/gcmd/gcmd_parser.go +++ b/os/gcmd/gcmd_parser.go @@ -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. }