From a282d1e5557c88c27eaa0f080cfa9ed591948450 Mon Sep 17 00:00:00 2001 From: rsteube Date: Mon, 25 Sep 2023 18:17:10 +0200 Subject: [PATCH] tmp --- example/cmd/compat.go | 4 ++++ example/cmd/compat_test.go | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/example/cmd/compat.go b/example/cmd/compat.go index feb1345a4..1a8771411 100644 --- a/example/cmd/compat.go +++ b/example/cmd/compat.go @@ -49,4 +49,8 @@ func init() { compatCmd.RegisterFlagCompletionFunc("filterdirs-chdir", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return []string{"subdir"}, cobra.ShellCompDirectiveFilterDirs }) + + compatCmd.RegisterFlagCompletionFunc("keeporder", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return []string{"one", "three", "two"}, cobra.ShellCompDirectiveKeepOrder + }) } diff --git a/example/cmd/compat_test.go b/example/cmd/compat_test.go index c0e2b83c4..7d3f5a71f 100644 --- a/example/cmd/compat_test.go +++ b/example/cmd/compat_test.go @@ -58,5 +58,12 @@ func TestCompat(t *testing.T) { Tag("directories"). StyleF(style.ForPathExt). Usage("ShellCompDirectiveFilterDirs")) + + s.Run("compat", "--keeporder", ""). + Expect(carapace.ActionValues( + "one", + "two", + "three", + ).Usage("ShellCompDirectiveKeepOrder")) }) }