Skip to content

Commit 756ba6d

Browse files
authored
fix(completions): Complete map flags multiple times (#2174)
1 parent 371ae25 commit 756ba6d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

completions.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,9 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi
401401
doCompleteFlags := func(flag *pflag.Flag) {
402402
if !flag.Changed ||
403403
strings.Contains(flag.Value.Type(), "Slice") ||
404-
strings.Contains(flag.Value.Type(), "Array") {
405-
// If the flag is not already present, or if it can be specified multiple times (Array or Slice)
404+
strings.Contains(flag.Value.Type(), "Array") ||
405+
strings.HasPrefix(flag.Value.Type(), "stringTo") {
406+
// If the flag is not already present, or if it can be specified multiple times (Array, Slice, or stringTo)
406407
// we suggest it as a completion
407408
completions = append(completions, getFlagNameCompletions(flag, toComplete)...)
408409
}

0 commit comments

Comments
 (0)