Skip to content

Commit

Permalink
feat: cli completion
Browse files Browse the repository at this point in the history
related to #8723

Signed-off-by: Mårten Svantesson <Marten.Svantesson@ticket.se>
  • Loading branch information
msvticket committed Nov 9, 2024
1 parent 61d42d4 commit 42e585d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func aliasCommand(rootCmd *cobra.Command, fn func(cmd *cobra.Command, args []str
ValidArgsFunction: func(cmd *cobra.Command, completeArgs []string, toComplete string) ([]string, cobra.ShellCompDirective) {
cmd, pluginArgs, err := rootCmd.Find(args)
if err != nil {
return nil, cobra.ShellCompDirectiveError
return nil, cobra.ShellCompDirectiveNoFileComp
}
return plugins.PluginCompletion(cmd, append(pluginArgs, completeArgs...), toComplete)
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/plugins/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,11 @@ func PluginCompletion(cmd *cobra.Command, args []string, toComplete string) ([]s

pluginDir, err := homedir.DefaultPluginBinDir()
if err != nil {
return nil, cobra.ShellCompDirectiveError
return nil, cobra.ShellCompDirectiveNoFileComp
}
path, err := Lookup(pluginName, pluginDir)
if err != nil {
return nil, cobra.ShellCompDirectiveError
return nil, cobra.ShellCompDirectiveNoFileComp
}

newArgs := make([]string, len(args)+2)
Expand Down

0 comments on commit 42e585d

Please sign in to comment.