From 756ba6dad61458cbbf7abecfc502d230574c57d2 Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Sun, 28 Jul 2024 11:18:07 -0500 Subject: [PATCH] fix(completions): Complete map flags multiple times (#2174) --- completions.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/completions.go b/completions.go index c0c08b05..8fccdaf2 100644 --- a/completions.go +++ b/completions.go @@ -401,8 +401,9 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi doCompleteFlags := func(flag *pflag.Flag) { if !flag.Changed || strings.Contains(flag.Value.Type(), "Slice") || - strings.Contains(flag.Value.Type(), "Array") { - // If the flag is not already present, or if it can be specified multiple times (Array or Slice) + strings.Contains(flag.Value.Type(), "Array") || + strings.HasPrefix(flag.Value.Type(), "stringTo") { + // If the flag is not already present, or if it can be specified multiple times (Array, Slice, or stringTo) // we suggest it as a completion completions = append(completions, getFlagNameCompletions(flag, toComplete)...) }