Disable autocompletion entirely when its not required
This commit is contained in:
parent
90ac9d379a
commit
e919673201
@ -1231,7 +1231,7 @@ func completionHandler(cmd *cobra.Command, args []string) error {
|
|||||||
case "fish":
|
case "fish":
|
||||||
err = cmd.Root().GenFishCompletion(os.Stdout, true)
|
err = cmd.Root().GenFishCompletion(os.Stdout, true)
|
||||||
default:
|
default:
|
||||||
err = errors.New("unsupported shell")
|
err = errors.New("unsupported shell. Supported shells: zsh, fish, bash")
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "error: %s\n", err)
|
fmt.Fprintf(os.Stderr, "error: %s\n", err)
|
||||||
@ -1317,6 +1317,7 @@ func NewCLI() *cobra.Command {
|
|||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
PreRunE: checkServerHeartbeat,
|
PreRunE: checkServerHeartbeat,
|
||||||
RunE: CreateHandler,
|
RunE: CreateHandler,
|
||||||
|
ValidArgsFunction: doNotAutocomplete,
|
||||||
}
|
}
|
||||||
|
|
||||||
createCmd.Flags().StringP("file", "f", "Modelfile", "Name of the Modelfile (default \"Modelfile\")")
|
createCmd.Flags().StringP("file", "f", "Modelfile", "Name of the Modelfile (default \"Modelfile\")")
|
||||||
@ -1356,6 +1357,7 @@ func NewCLI() *cobra.Command {
|
|||||||
Short: "Start ollama",
|
Short: "Start ollama",
|
||||||
Args: cobra.ExactArgs(0),
|
Args: cobra.ExactArgs(0),
|
||||||
RunE: RunServer,
|
RunE: RunServer,
|
||||||
|
ValidArgsFunction: doNotAutocomplete,
|
||||||
}
|
}
|
||||||
|
|
||||||
pullCmd := &cobra.Command{
|
pullCmd := &cobra.Command{
|
||||||
@ -1386,6 +1388,7 @@ func NewCLI() *cobra.Command {
|
|||||||
Short: "List models",
|
Short: "List models",
|
||||||
PreRunE: checkServerHeartbeat,
|
PreRunE: checkServerHeartbeat,
|
||||||
RunE: ListHandler,
|
RunE: ListHandler,
|
||||||
|
ValidArgsFunction: doNotAutocomplete,
|
||||||
}
|
}
|
||||||
|
|
||||||
copyCmd := &cobra.Command{
|
copyCmd := &cobra.Command{
|
||||||
@ -1413,6 +1416,9 @@ func NewCLI() *cobra.Command {
|
|||||||
Hidden: true,
|
Hidden: true,
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
RunE: completionHandler,
|
RunE: completionHandler,
|
||||||
|
ValidArgsFunction: func(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||||
|
return []string{"bash", "zsh", "fish"}, cobra.ShellCompDirectiveNoFileComp
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
rootCmd.AddCommand(
|
rootCmd.AddCommand(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user