Merge pull request #6445 from thaJeztah/add_plugin_completions · docker/cli@d391d0f · GitHub
Skip to content

Commit d391d0f

Browse files
authored
Merge pull request #6445 from thaJeztah/add_plugin_completions
cli/command/plugin: add completion for plugin subcommands
2 parents 2f6abcf + 467fcfe commit d391d0f

10 files changed

Lines changed: 54 additions & 1 deletion

File tree

‎cli/command/plugin/completion.go‎

Lines changed: 45 additions & 0 deletions

‎cli/command/plugin/create.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
7676
options.context = args[1]
7777
return runCreate(cmd.Context(), dockerCLI, options)
7878
},
79-
ValidArgsFunction: cobra.NoFileCompletions,
79+
ValidArgsFunction: cobra.NoFileCompletions, // TODO(thaJeztah): should provide "directory" completion for the second arg
8080
DisableFlagsInUseLine: true,
8181
}
8282

‎cli/command/plugin/disable.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func newDisableCommand(dockerCLI command.Cli) *cobra.Command {
2424
_, _ = fmt.Fprintln(dockerCLI.Out(), name)
2525
return nil
2626
},
27+
ValidArgsFunction: completeNames(dockerCLI, stateEnabled),
2728
DisableFlagsInUseLine: true,
2829
}
2930

‎cli/command/plugin/enable.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func newEnableCommand(dockerCLI command.Cli) *cobra.Command {
2525
_, _ = fmt.Fprintln(dockerCLI.Out(), name)
2626
return nil
2727
},
28+
ValidArgsFunction: completeNames(dockerCLI, stateDisabled),
2829
DisableFlagsInUseLine: true,
2930
}
3031

‎cli/command/plugin/inspect.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
2929
opts.pluginNames = args
3030
return runInspect(cmd.Context(), dockerCLI, opts)
3131
},
32+
ValidArgsFunction: completeNames(dockerCLI, stateAny),
3233
DisableFlagsInUseLine: true,
3334
}
3435

‎cli/command/plugin/install.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func newInstallCommand(dockerCLI command.Cli) *cobra.Command {
3636
}
3737
return runInstall(cmd.Context(), dockerCLI, options)
3838
},
39+
ValidArgsFunction: cobra.NoFileCompletions,
3940
DisableFlagsInUseLine: true,
4041
}
4142

‎cli/command/plugin/push.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func newPushCommand(dockerCLI command.Cli) *cobra.Command {
2020
name := args[0]
2121
return runPush(cmd.Context(), dockerCLI, name)
2222
},
23+
ValidArgsFunction: completeNames(dockerCLI, stateAny),
2324
DisableFlagsInUseLine: true,
2425
}
2526

‎cli/command/plugin/remove.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
2929
opts.plugins = args
3030
return runRemove(cmd.Context(), dockerCLI, &opts)
3131
},
32+
ValidArgsFunction: completeNames(dockerCLI, stateAny),
3233
DisableFlagsInUseLine: true,
3334
}
3435

‎cli/command/plugin/set.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ func newSetCommand(dockerCLI command.Cli) *cobra.Command {
1414
RunE: func(cmd *cobra.Command, args []string) error {
1515
return dockerCLI.Client().PluginSet(cmd.Context(), args[0], args[1:])
1616
},
17+
ValidArgsFunction: completeNames(dockerCLI, stateAny), // TODO(thaJeztah): should only complete for the first arg
1718
DisableFlagsInUseLine: true,
1819
}
1920
}

‎cli/command/plugin/upgrade.go‎

Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)