File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -685,18 +685,23 @@ func flipBoolValue(value reflect.Value) error {
685685func (c * Context ) parseFlag (flags []* Flag , match string ) (err error ) {
686686 candidates := []string {}
687687
688- newCandidate := func (s string ) bool {
689- candidates = append (candidates , s )
690- return s == match
691- }
692-
693688 for _ , flag := range flags {
694- matched := newCandidate ("--" + flag .Name )
689+ flagCandidates := []string {}
690+ flagCandidates = append (flagCandidates , "--" + flag .Name )
695691 if flag .Short != 0 {
696- matched = matched || newCandidate ( "-" + string (flag .Short ))
692+ flagCandidates = append ( flagCandidates , "-" + string (flag .Short ))
697693 }
698694 for _ , alias := range flag .Aliases {
699- matched = matched || newCandidate ("--" + alias )
695+ flagCandidates = append (flagCandidates , "--" + alias )
696+ }
697+ candidates = append (candidates , flagCandidates ... )
698+
699+ var matched bool
700+ for _ , candidate := range flagCandidates {
701+ if candidate == match {
702+ matched = true
703+ break
704+ }
700705 }
701706
702707 neg := "--no-" + flag .Name
You can’t perform that action at this time.
0 commit comments