mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
fix configuration support for package gcmd
This commit is contained in:
@ -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
|
||||
|
||||
@ -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.
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user