Skip to content

Commit 4f29af7

Browse files
committed
use TrimLeft instead of TrimPrefix
1 parent afd23df commit 4f29af7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

help.go

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

192192
func printFlagSuggestions(lastArg string, flags []Flag, writer io.Writer) {
193-
// Trim the prefix twice to handle both "-short" and "--long" flags.
194-
cur := strings.TrimPrefix(lastArg, "-")
195-
cur = strings.TrimPrefix(cur, "-")
193+
// Trim to handle both "-short" and "--long" flags.
194+
cur := strings.TrimLeft(lastArg, "-")
196195
for _, flag := range flags {
197196
if bflag, ok := flag.(*BoolFlag); ok && bflag.Hidden {
198197
continue

0 commit comments

Comments
 (0)