Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Sep 25, 2023
1 parent a282d1e commit e29106f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion example/cmd/compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func init() {
compatCmd.Flags().String("filterdirs", "", "ShellCompDirectiveFilterDirs")
compatCmd.Flags().String("filterdirs-chdir", "", "ShellCompDirectiveFilterDirs")
compatCmd.Flags().String("keeporder", "", "ShellCompDirectiveKeepOrder")
compatCmd.Flags().String("maxvalue", "", "shellCompDirectiveMaxValue")
compatCmd.Flags().String("default", "", "ShellCompDirectiveDefault")

rootCmd.AddCommand(compatCmd)
Expand Down Expand Up @@ -53,4 +52,8 @@ func init() {
compatCmd.RegisterFlagCompletionFunc("keeporder", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return []string{"one", "three", "two"}, cobra.ShellCompDirectiveKeepOrder
})

compatCmd.RegisterFlagCompletionFunc("default", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return nil, cobra.ShellCompDirectiveDefault
})
}
11 changes: 11 additions & 0 deletions example/cmd/compat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,16 @@ func TestCompat(t *testing.T) {
"two",
"three",
).Usage("ShellCompDirectiveKeepOrder"))

s.Run("compat", "--default", "").
Expect(carapace.ActionValues(
"subdir/",
"go.mod",
"go.sum",
"README.md",
).NoSpace('/').
Tag("files").
StyleF(style.ForPath).
Usage("ShellCompDirectiveDefault"))
})
}

0 comments on commit e29106f

Please sign in to comment.