Skip to content

Commit de30973

Browse files
committed
revert var name change
1 parent 9b41c34 commit de30973

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

help.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ func cliArgContains(flagName string, args []string) bool {
191191

192192
func printFlagSuggestions(lastArg string, flags []Flag, writer io.Writer) {
193193
// Trim the prefix twice to handle both "-short" and "--long" flags.
194-
currentArg := strings.TrimPrefix(lastArg, "-")
195-
currentArg = strings.TrimPrefix(currentArg, "-")
194+
cur := strings.TrimPrefix(lastArg, "-")
195+
cur = strings.TrimPrefix(cur, "-")
196196
for _, flag := range flags {
197197
if bflag, ok := flag.(*BoolFlag); ok && bflag.Hidden {
198198
continue
@@ -215,7 +215,7 @@ func printFlagSuggestions(lastArg string, flags []Flag, writer io.Writer) {
215215
continue
216216
}
217217
// match if last argument matches this flag and it is not repeated
218-
if strings.HasPrefix(name, currentArg) && currentArg != name && !cliArgContains(name, os.Args) {
218+
if strings.HasPrefix(name, cur) && cur != name && !cliArgContains(name, os.Args) {
219219
flagCompletion := fmt.Sprintf("%s%s", strings.Repeat("-", count), name)
220220
if usage != "" && strings.HasSuffix(os.Getenv("SHELL"), "zsh") {
221221
flagCompletion = fmt.Sprintf("%s:%s", flagCompletion, usage)

0 commit comments

Comments
 (0)