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 b901b8d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions help.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ 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, "-")
cur := strings.TrimLeft(lastArg, "-")
for _, flag := range flags {
if bflag, ok := flag.(*BoolFlag); ok && bflag.Hidden {
continue
Expand Down

0 comments on commit b901b8d

Please sign in to comment.