Skip to content

Commit

Permalink
use TrimLeft instead of TrimPrefix
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Nov 24, 2024
1 parent afd23df commit 4f29af7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions help.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,8 @@ func cliArgContains(flagName string, args []string) bool {
}

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

0 comments on commit 4f29af7

Please sign in to comment.