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 e29106f commit 2034e64
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions example/cmd/compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ func init() {
compatCmd.Flags().String("keeporder", "", "ShellCompDirectiveKeepOrder")
compatCmd.Flags().String("default", "", "ShellCompDirectiveDefault")

compatCmd.Flags().String("unset", "", "no completions defined")

rootCmd.AddCommand(compatCmd)

compatCmd.RegisterFlagCompletionFunc("error", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
Expand Down
4 changes: 4 additions & 0 deletions example/cmd/compat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,9 @@ func TestCompat(t *testing.T) {
Tag("files").
StyleF(style.ForPath).
Usage("ShellCompDirectiveDefault"))

s.Run("compat", "--unset", "").
Expect(carapace.ActionValues().
Usage("no completions defined"))
})
}
5 changes: 3 additions & 2 deletions storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ func (s _storage) bridge(cmd *cobra.Command) {
defer bridgeMutex.Unlock()

if !entry.initialized {
registerValidArgsFunction(cmd)
registerFlagCompletion(cmd)
// TODO only if completion is defined in carapace
// registerValidArgsFunction(cmd)
// registerFlagCompletion(cmd)
entry.initialized = true
}

Expand Down

0 comments on commit 2034e64

Please sign in to comment.