mirror of https://github.com/docker/cli.git
Merge pull request #6401 from thaJeztah/check_DisableFlagsInUseLine
verify that DisableFlagsInUseLine is set for all commands
This commit is contained in:
commit
89874983c8
|
|
@ -24,6 +24,8 @@ func newBuilderCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Args: cli.NoArgs,
|
||||
RunE: command.ShowHelp(dockerCLI.Err()),
|
||||
Annotations: map[string]string{"version": "1.31"},
|
||||
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
cmd.AddCommand(
|
||||
newPruneCommand(dockerCLI),
|
||||
|
|
@ -50,5 +52,6 @@ func newBakeStubCommand(dockerCLI command.Streams) *cobra.Command {
|
|||
"aliases": "docker buildx bake",
|
||||
"version": "1.31",
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,8 +50,9 @@ func newPruneCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
_, _ = fmt.Fprintln(dockerCLI.Out(), "Total reclaimed space:", units.HumanSize(float64(spaceReclaimed)))
|
||||
return nil
|
||||
},
|
||||
Annotations: map[string]string{"version": "1.39"},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
Annotations: map[string]string{"version": "1.39"},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ func newCheckpointCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
"ostype": "linux",
|
||||
"version": "1.25",
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
cmd.AddCommand(
|
||||
newCreateCommand(dockerCLI),
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ type createOptions struct {
|
|||
leaveRunning bool
|
||||
}
|
||||
|
||||
func newCreateCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts createOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -27,9 +27,10 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command {
|
|||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
opts.container = args[0]
|
||||
opts.checkpoint = args[1]
|
||||
return runCreate(cmd.Context(), dockerCli, opts)
|
||||
return runCreate(cmd.Context(), dockerCLI, opts)
|
||||
},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ type listOptions struct {
|
|||
checkpointDir string
|
||||
}
|
||||
|
||||
func newListCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newListCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts listOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -24,9 +24,10 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Short: "List checkpoints for a container",
|
||||
Args: cli.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runList(cmd.Context(), dockerCli, args[0], opts)
|
||||
return runList(cmd.Context(), dockerCLI, args[0], opts)
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCli, false),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ type removeOptions struct {
|
|||
checkpointDir string
|
||||
}
|
||||
|
||||
func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts removeOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -22,8 +22,9 @@ func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Short: "Remove a checkpoint",
|
||||
Args: cli.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runRemove(cmd.Context(), dockerCli, args[0], args[1], opts)
|
||||
return runRemove(cmd.Context(), dockerCLI, args[0], args[1], opts)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ func newConfigCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
"version": "1.30",
|
||||
"swarm": "manager",
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
cmd.AddCommand(
|
||||
newConfigListCommand(dockerCLI),
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ func newConfigCreateCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
createOpts.file = args[1]
|
||||
return runCreate(cmd.Context(), dockerCLI, createOpts)
|
||||
},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
flags := cmd.Flags()
|
||||
flags.VarP(&createOpts.labels, "label", "l", "Config labels")
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ func newConfigInspectCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
return completeNames(dockerCLI)(cmd, args, toComplete)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
cmd.Flags().StringVarP(&opts.format, "format", "f", "", flagsHelper.InspectFormatHelp)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ func newConfigListCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runList(cmd.Context(), dockerCLI, listOpts)
|
||||
},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ func newConfigRemoveCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
return completeNames(dockerCLI)(cmd, args, toComplete)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ func newAttachCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false, func(ctr container.Summary) bool {
|
||||
return ctr.State != container.StatePaused
|
||||
}),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ func newContainerCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Short: "Manage containers",
|
||||
Args: cli.NoArgs,
|
||||
RunE: command.ShowHelp(dockerCLI.Err()),
|
||||
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
cmd.AddCommand(
|
||||
newAttachCommand(dockerCLI),
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ func newCommitCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker container commit, docker commit",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ container source to stdout.`,
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker container cp, docker cp",
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -69,7 +69,8 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker container create, docker create",
|
||||
},
|
||||
ValidArgsFunction: completion.ImageNames(dockerCLI, -1),
|
||||
ValidArgsFunction: completion.ImageNames(dockerCLI, -1),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ func newDiffCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker container diff, docker diff",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ func newExecCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
"category-top": "2",
|
||||
"aliases": "docker container exec, docker exec",
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ func newExportCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker container export, docker export",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, true),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, true),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ type inspectOptions struct {
|
|||
}
|
||||
|
||||
// newInspectCommand creates a new cobra.Command for `docker container inspect`
|
||||
func newInspectCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts inspectOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -30,9 +30,10 @@ func newInspectCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Args: cli.RequiresMinArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
opts.refs = args
|
||||
return runInspect(cmd.Context(), dockerCli, opts)
|
||||
return runInspect(cmd.Context(), dockerCLI, opts)
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCli, true),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, true),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ func newKillCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker container kill, docker kill",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ func newPsCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
"category-top": "3",
|
||||
"aliases": "docker container ls, docker container list, docker container ps, docker ps",
|
||||
},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ func newLogsCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker container logs, docker logs",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, true),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, true),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ func newPauseCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false, func(ctr container.Summary) bool {
|
||||
return ctr.State != container.StatePaused
|
||||
}),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ type portOptions struct {
|
|||
}
|
||||
|
||||
// newPortCommand creates a new cobra.Command for "docker container port".
|
||||
func newPortCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newPortCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts portOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -36,12 +36,13 @@ func newPortCommand(dockerCli command.Cli) *cobra.Command {
|
|||
if len(args) > 1 {
|
||||
opts.port = args[1]
|
||||
}
|
||||
return runPort(cmd.Context(), dockerCli, &opts)
|
||||
return runPort(cmd.Context(), dockerCLI, &opts)
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
"aliases": "docker container port, docker port",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCli, false),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,8 +45,9 @@ func newPruneCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
fmt.Fprintln(dockerCLI.Out(), "Total reclaimed space:", units.HumanSize(float64(spaceReclaimed)))
|
||||
return nil
|
||||
},
|
||||
Annotations: map[string]string{"version": "1.25"},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
Annotations: map[string]string{"version": "1.25"},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ func newRenameCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker container rename, docker rename",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, true),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, true),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ func newRestartCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker container restart, docker restart",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, true),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, true),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ func newRmCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
ValidArgsFunction: completion.ContainerNames(dockerCLI, true, func(ctr container.Summary) bool {
|
||||
return opts.force || ctr.State == container.StateExited || ctr.State == container.StateCreated
|
||||
}),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ func newRunCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
"category-top": "1",
|
||||
"aliases": "docker container run, docker run",
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ type StartOptions struct {
|
|||
}
|
||||
|
||||
// newStartCommand creates a new cobra.Command for "docker container start".
|
||||
func newStartCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newStartCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts StartOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -37,14 +37,15 @@ func newStartCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Args: cli.RequiresMinArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
opts.Containers = args
|
||||
return RunStart(cmd.Context(), dockerCli, &opts)
|
||||
return RunStart(cmd.Context(), dockerCLI, &opts)
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
"aliases": "docker container start, docker start",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCli, true, func(ctr container.Summary) bool {
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, true, func(ctr container.Summary) bool {
|
||||
return ctr.State == container.StateExited || ctr.State == container.StateCreated
|
||||
}),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -79,7 +79,8 @@ func newStatsCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker container stats, docker stats",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ func newStopCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker container stop, docker stop",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ func newTopCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker container top, docker top",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ type unpauseOptions struct {
|
|||
}
|
||||
|
||||
// newUnpauseCommand creates a new cobra.Command for "docker container unpause".
|
||||
func newUnpauseCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newUnpauseCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts unpauseOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -26,14 +26,15 @@ func newUnpauseCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Args: cli.RequiresMinArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
opts.containers = args
|
||||
return runUnpause(cmd.Context(), dockerCli, &opts)
|
||||
return runUnpause(cmd.Context(), dockerCLI, &opts)
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
"aliases": "docker container unpause, docker unpause",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCli, false, func(ctr container.Summary) bool {
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false, func(ctr container.Summary) bool {
|
||||
return ctr.State == container.StatePaused
|
||||
}),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ func newUpdateCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker container update, docker update",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, true),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, true),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ func newWaitCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker container wait, docker wait",
|
||||
},
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
ValidArgsFunction: completion.ContainerNames(dockerCLI, false),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
return cmd
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ func newContextCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Short: "Manage contexts",
|
||||
Args: cli.NoArgs,
|
||||
RunE: command.ShowHelp(dockerCLI.Err()),
|
||||
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
cmd.AddCommand(
|
||||
newCreateCommand(dockerCLI),
|
||||
|
|
|
|||
|
|
@ -52,8 +52,9 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
opts.name = args[0]
|
||||
return runCreate(dockerCLI, &opts)
|
||||
},
|
||||
Long: longCreateDescription(),
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
Long: longCreateDescription(),
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
flags := cmd.Flags()
|
||||
flags.StringVar(&opts.description, "description", "", "Description of the context")
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ func newExportCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
}
|
||||
return runExport(dockerCLI, contextName, dest)
|
||||
},
|
||||
ValidArgsFunction: completeContextNames(dockerCLI, 1, true),
|
||||
ValidArgsFunction: completeContextNames(dockerCLI, 1, true),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,16 +12,17 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func newImportCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newImportCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "import CONTEXT FILE|-",
|
||||
Short: "Import a context from a tar or zip file",
|
||||
Args: cli.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runImport(dockerCli, args[0], args[1])
|
||||
return runImport(dockerCLI, args[0], args[1])
|
||||
},
|
||||
// TODO(thaJeztah): this should also include "-"
|
||||
ValidArgsFunction: completion.FileNames,
|
||||
ValidArgsFunction: completion.FileNames,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
}
|
||||
return runInspect(dockerCLI, opts)
|
||||
},
|
||||
ValidArgsFunction: completeContextNames(dockerCLI, -1, false),
|
||||
ValidArgsFunction: completeContextNames(dockerCLI, -1, false),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ type listOptions struct {
|
|||
quiet bool
|
||||
}
|
||||
|
||||
func newListCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newListCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
opts := &listOptions{}
|
||||
cmd := &cobra.Command{
|
||||
Use: "ls [OPTIONS]",
|
||||
|
|
@ -31,9 +31,10 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Short: "List contexts",
|
||||
Args: cli.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runList(dockerCli, opts)
|
||||
return runList(dockerCLI, opts)
|
||||
},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runRemove(dockerCLI, opts, args)
|
||||
},
|
||||
ValidArgsFunction: completeContextNames(dockerCLI, -1, false),
|
||||
ValidArgsFunction: completeContextNames(dockerCLI, -1, false),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
cmd.Flags().BoolVarP(&opts.force, "force", "f", false, "Force the removal of a context in use")
|
||||
return cmd
|
||||
|
|
|
|||
|
|
@ -9,16 +9,17 @@ import (
|
|||
)
|
||||
|
||||
// newShowCommand creates a new cobra.Command for `docker context sow`
|
||||
func newShowCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newShowCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "show",
|
||||
Short: "Print the name of the current context",
|
||||
Args: cli.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
runShow(dockerCli)
|
||||
runShow(dockerCLI)
|
||||
return nil
|
||||
},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,8 +42,9 @@ func newUpdateCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
opts.name = args[0]
|
||||
return runUpdate(dockerCLI, &opts)
|
||||
},
|
||||
Long: longUpdateDescription(),
|
||||
ValidArgsFunction: completeContextNames(dockerCLI, 1, false),
|
||||
Long: longUpdateDescription(),
|
||||
ValidArgsFunction: completeContextNames(dockerCLI, 1, false),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
flags := cmd.Flags()
|
||||
flags.StringVar(&opts.description, "description", "", "Description of the context")
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ func newUseCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
name := args[0]
|
||||
return runUse(dockerCLI, name)
|
||||
},
|
||||
ValidArgsFunction: completeContextNames(dockerCLI, 1, false),
|
||||
ValidArgsFunction: completeContextNames(dockerCLI, 1, false),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ func NewBuildCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
}
|
||||
|
||||
// newBuildCommand creates a new `docker build` command
|
||||
func newBuildCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newBuildCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
options := newBuildOptions()
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -97,7 +97,7 @@ func newBuildCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Args: cli.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
options.context = args[0]
|
||||
return runBuild(cmd.Context(), dockerCli, options)
|
||||
return runBuild(cmd.Context(), dockerCLI, options)
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
"category-top": "4",
|
||||
|
|
@ -106,6 +106,7 @@ func newBuildCommand(dockerCli command.Cli) *cobra.Command {
|
|||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
return nil, cobra.ShellCompDirectiveFilterDirs
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
@ -146,7 +147,7 @@ func newBuildCommand(dockerCli command.Cli) *cobra.Command {
|
|||
flags.SetAnnotation("target", annotation.ExternalURL, []string{"https://docs.docker.com/reference/cli/docker/buildx/build/#target"})
|
||||
flags.StringVar(&options.imageIDFile, "iidfile", "", "Write the image ID to the file")
|
||||
|
||||
flags.Bool("disable-content-trust", dockerCli.ContentTrustEnabled(), "Skip image verification (deprecated)")
|
||||
flags.Bool("disable-content-trust", dockerCLI.ContentTrustEnabled(), "Skip image verification (deprecated)")
|
||||
_ = flags.MarkHidden("disable-content-trust")
|
||||
|
||||
flags.StringVar(&options.platform, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Set platform if server is multi-platform capable")
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ func newImageCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Short: "Manage images",
|
||||
Args: cli.NoArgs,
|
||||
RunE: command.ShowHelp(dockerCli.Err()),
|
||||
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
cmd.AddCommand(
|
||||
newBuildCommand(dockerCli),
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ func newHistoryCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker image history, docker history",
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ func newImportCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker image import, docker import",
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ type inspectOptions struct {
|
|||
}
|
||||
|
||||
// newInspectCommand creates a new cobra.Command for `docker image inspect`
|
||||
func newInspectCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts inspectOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -35,9 +35,10 @@ func newInspectCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Args: cli.RequiresMinArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
opts.refs = args
|
||||
return runInspect(cmd.Context(), dockerCli, opts)
|
||||
return runInspect(cmd.Context(), dockerCLI, opts)
|
||||
},
|
||||
ValidArgsFunction: completion.ImageNames(dockerCli, -1),
|
||||
ValidArgsFunction: completion.ImageNames(dockerCLI, -1),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ func newImagesCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
"category-top": "7",
|
||||
"aliases": "docker image ls, docker image list, docker images",
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ func newLoadCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker image load, docker load",
|
||||
},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -48,8 +48,9 @@ func newPruneCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
fmt.Fprintln(dockerCLI.Out(), "Total reclaimed space:", units.HumanSize(float64(spaceReclaimed)))
|
||||
return nil
|
||||
},
|
||||
Annotations: map[string]string{"version": "1.25"},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
Annotations: map[string]string{"version": "1.25"},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ func newPullCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
"category-top": "5",
|
||||
"aliases": "docker image pull, docker pull",
|
||||
},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ func newPushCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
"category-top": "6",
|
||||
"aliases": "docker image push, docker push",
|
||||
},
|
||||
ValidArgsFunction: completion.ImageNames(dockerCLI, 1),
|
||||
ValidArgsFunction: completion.ImageNames(dockerCLI, 1),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker image rm, docker image remove, docker rmi",
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ func newSaveCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"aliases": "docker image save, docker save",
|
||||
},
|
||||
ValidArgsFunction: completion.ImageNames(dockerCLI, -1),
|
||||
ValidArgsFunction: completion.ImageNames(dockerCLI, -1),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ type tagOptions struct {
|
|||
}
|
||||
|
||||
// newTagCommand creates a new "docker image tag" command.
|
||||
func newTagCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newTagCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts tagOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -25,12 +25,13 @@ func newTagCommand(dockerCli command.Cli) *cobra.Command {
|
|||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
opts.image = args[0]
|
||||
opts.name = args[1]
|
||||
return runTag(cmd.Context(), dockerCli, opts)
|
||||
return runTag(cmd.Context(), dockerCLI, opts)
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
"aliases": "docker image tag, docker tag",
|
||||
},
|
||||
ValidArgsFunction: completion.ImageNames(dockerCli, 2),
|
||||
ValidArgsFunction: completion.ImageNames(dockerCLI, 2),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ func newRegistryClient(dockerCLI command.Cli, allowInsecure bool) registryclient
|
|||
}
|
||||
|
||||
// NewAnnotateCommand creates a new `docker manifest annotate` command
|
||||
func newAnnotateCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newAnnotateCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts annotateOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -67,8 +67,9 @@ func newAnnotateCommand(dockerCli command.Cli) *cobra.Command {
|
|||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
opts.target = args[0]
|
||||
opts.image = args[1]
|
||||
return runManifestAnnotate(dockerCli, opts)
|
||||
return runManifestAnnotate(dockerCLI, opts)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ func newManifestCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Run: func(cmd *cobra.Command, args []string) {
|
||||
_, _ = fmt.Fprint(dockerCLI.Err(), "\n"+cmd.UsageString())
|
||||
},
|
||||
Annotations: map[string]string{"experimentalCLI": ""},
|
||||
Annotations: map[string]string{"experimentalCLI": ""},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
cmd.AddCommand(
|
||||
newCreateListCommand(dockerCLI),
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ type createOpts struct {
|
|||
insecure bool
|
||||
}
|
||||
|
||||
func newCreateListCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newCreateListCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
opts := createOpts{}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -24,8 +24,9 @@ func newCreateListCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Short: "Create a local manifest list for annotating and pushing to a registry",
|
||||
Args: cli.RequiresMinArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return createManifestList(cmd.Context(), dockerCli, args, opts)
|
||||
return createManifestList(cmd.Context(), dockerCLI, args, opts)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ type inspectOptions struct {
|
|||
}
|
||||
|
||||
// NewInspectCommand creates a new `docker manifest inspect` command
|
||||
func newInspectCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts inspectOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -37,8 +37,9 @@ func newInspectCommand(dockerCli command.Cli) *cobra.Command {
|
|||
opts.list = args[0]
|
||||
opts.ref = args[1]
|
||||
}
|
||||
return runInspect(cmd.Context(), dockerCli, opts)
|
||||
return runInspect(cmd.Context(), dockerCLI, opts)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ type pushRequest struct {
|
|||
insecure bool
|
||||
}
|
||||
|
||||
func newPushListCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newPushListCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
opts := pushOpts{}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -51,8 +51,9 @@ func newPushListCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Args: cli.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
opts.target = args[0]
|
||||
return runPush(cmd.Context(), dockerCli, opts)
|
||||
return runPush(cmd.Context(), dockerCLI, opts)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ func newRmManifestListCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runRemove(cmd.Context(), newManifestStore(dockerCLI), args)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
return cmd
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ func newNetworkCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Args: cli.NoArgs,
|
||||
RunE: command.ShowHelp(dockerCLI.Err()),
|
||||
Annotations: map[string]string{"version": "1.21"},
|
||||
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
cmd.AddCommand(
|
||||
newConnectCommand(dockerCLI),
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ func newConnectCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
nw := args[0]
|
||||
return completion.ContainerNames(dockerCLI, true, not(isConnected(nw)))(cmd, args, toComplete)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
|
||||
return runCreate(cmd.Context(), dockerCLI.Client(), dockerCLI.Out(), options)
|
||||
},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ type disconnectOptions struct {
|
|||
force bool
|
||||
}
|
||||
|
||||
func newDisconnectCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newDisconnectCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
opts := disconnectOptions{}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -27,15 +27,16 @@ func newDisconnectCommand(dockerCli command.Cli) *cobra.Command {
|
|||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
opts.network = args[0]
|
||||
opts.container = args[1]
|
||||
return runDisconnect(cmd.Context(), dockerCli.Client(), opts)
|
||||
return runDisconnect(cmd.Context(), dockerCLI.Client(), opts)
|
||||
},
|
||||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) == 0 {
|
||||
return completion.NetworkNames(dockerCli)(cmd, args, toComplete)
|
||||
return completion.NetworkNames(dockerCLI)(cmd, args, toComplete)
|
||||
}
|
||||
network := args[0]
|
||||
return completion.ContainerNames(dockerCli, true, isConnected(network))(cmd, args, toComplete)
|
||||
return completion.ContainerNames(dockerCLI, true, isConnected(network))(cmd, args, toComplete)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
opts.names = args
|
||||
return runInspect(cmd.Context(), dockerCLI.Client(), dockerCLI.Out(), opts)
|
||||
},
|
||||
ValidArgsFunction: completion.NetworkNames(dockerCLI),
|
||||
ValidArgsFunction: completion.NetworkNames(dockerCLI),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
cmd.Flags().StringVarP(&opts.format, "format", "f", "", flagsHelper.InspectFormatHelp)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ type listOptions struct {
|
|||
filter opts.FilterOpt
|
||||
}
|
||||
|
||||
func newListCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newListCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
options := listOptions{filter: opts.NewFilterOpt()}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -30,9 +30,10 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Short: "List networks",
|
||||
Args: cli.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runList(cmd.Context(), dockerCli, options)
|
||||
return runList(cmd.Context(), dockerCLI, options)
|
||||
},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ func newPruneCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
}
|
||||
return nil
|
||||
},
|
||||
Annotations: map[string]string{"version": "1.25"},
|
||||
Annotations: map[string]string{"version": "1.25"},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ type removeOptions struct {
|
|||
force bool
|
||||
}
|
||||
|
||||
func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts removeOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -27,9 +27,10 @@ func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Short: "Remove one or more networks",
|
||||
Args: cli.RequiresMinArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runRemove(cmd.Context(), dockerCli, args, &opts)
|
||||
return runRemove(cmd.Context(), dockerCLI, args, &opts)
|
||||
},
|
||||
ValidArgsFunction: completion.NetworkNames(dockerCli),
|
||||
ValidArgsFunction: completion.NetworkNames(dockerCLI),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ func newNodeCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
"version": "1.24",
|
||||
"swarm": "manager",
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
cmd.AddCommand(
|
||||
newDemoteCommand(dockerCLI),
|
||||
|
|
|
|||
|
|
@ -10,15 +10,16 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func newDemoteCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newDemoteCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "demote NODE [NODE...]",
|
||||
Short: "Demote one or more nodes from manager in the swarm",
|
||||
Args: cli.RequiresMinArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runDemote(cmd.Context(), dockerCli, args)
|
||||
return runDemote(cmd.Context(), dockerCLI, args)
|
||||
},
|
||||
ValidArgsFunction: completeNodeNames(dockerCli),
|
||||
ValidArgsFunction: completeNodeNames(dockerCLI),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ type inspectOptions struct {
|
|||
pretty bool
|
||||
}
|
||||
|
||||
func newInspectCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts inspectOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -30,9 +30,10 @@ func newInspectCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Args: cli.RequiresMinArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
opts.nodeIds = args
|
||||
return runInspect(cmd.Context(), dockerCli, opts)
|
||||
return runInspect(cmd.Context(), dockerCLI, opts)
|
||||
},
|
||||
ValidArgsFunction: completeNodeNames(dockerCli),
|
||||
ValidArgsFunction: completeNodeNames(dockerCLI),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ type listOptions struct {
|
|||
filter opts.FilterOpt
|
||||
}
|
||||
|
||||
func newListCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newListCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
options := listOptions{filter: opts.NewFilterOpt()}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -31,9 +31,10 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Short: "List nodes in the swarm",
|
||||
Args: cli.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runList(cmd.Context(), dockerCli, options)
|
||||
return runList(cmd.Context(), dockerCLI, options)
|
||||
},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
flags := cmd.Flags()
|
||||
flags.BoolVarP(&options.quiet, "quiet", "q", false, "Only display IDs")
|
||||
|
|
|
|||
|
|
@ -10,15 +10,16 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func newPromoteCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newPromoteCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "promote NODE [NODE...]",
|
||||
Short: "Promote one or more nodes to manager in the swarm",
|
||||
Args: cli.RequiresMinArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runPromote(cmd.Context(), dockerCli, args)
|
||||
return runPromote(cmd.Context(), dockerCLI, args)
|
||||
},
|
||||
ValidArgsFunction: completeNodeNames(dockerCli),
|
||||
ValidArgsFunction: completeNodeNames(dockerCLI),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ type psOptions struct {
|
|||
filter opts.FilterOpt
|
||||
}
|
||||
|
||||
func newPsCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newPsCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
options := psOptions{filter: opts.NewFilterOpt()}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -39,9 +39,10 @@ func newPsCommand(dockerCli command.Cli) *cobra.Command {
|
|||
options.nodeIDs = args
|
||||
}
|
||||
|
||||
return runPs(cmd.Context(), dockerCli, options)
|
||||
return runPs(cmd.Context(), dockerCLI, options)
|
||||
},
|
||||
ValidArgsFunction: completeNodeNames(dockerCli),
|
||||
ValidArgsFunction: completeNodeNames(dockerCLI),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
flags := cmd.Flags()
|
||||
flags.BoolVar(&options.noTrunc, "no-trunc", false, "Do not truncate output")
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ type removeOptions struct {
|
|||
force bool
|
||||
}
|
||||
|
||||
func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
opts := removeOptions{}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -24,9 +24,10 @@ func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Short: "Remove one or more nodes from the swarm",
|
||||
Args: cli.RequiresMinArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runRemove(cmd.Context(), dockerCli, args, opts)
|
||||
return runRemove(cmd.Context(), dockerCLI, args, opts)
|
||||
},
|
||||
ValidArgsFunction: completeNodeNames(dockerCli),
|
||||
ValidArgsFunction: completeNodeNames(dockerCLI),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
flags := cmd.Flags()
|
||||
flags.BoolVarP(&opts.force, "force", "f", false, "Force remove a node from the swarm")
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import (
|
|||
|
||||
var errNoRoleChange = errors.New("role was already set to the requested value")
|
||||
|
||||
func newUpdateCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newUpdateCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
options := newNodeOptions()
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -25,9 +25,10 @@ func newUpdateCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Short: "Update a node",
|
||||
Args: cli.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runUpdate(cmd.Context(), dockerCli, cmd.Flags(), args[0])
|
||||
return runUpdate(cmd.Context(), dockerCLI, cmd.Flags(), args[0])
|
||||
},
|
||||
ValidArgsFunction: completeNodeNames(dockerCli),
|
||||
ValidArgsFunction: completeNodeNames(dockerCLI),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ func newPluginCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Args: cli.NoArgs,
|
||||
RunE: command.ShowHelp(dockerCLI.Err()),
|
||||
Annotations: map[string]string{"version": "1.25"},
|
||||
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
cmd.AddCommand(
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ type pluginCreateOptions struct {
|
|||
compress bool
|
||||
}
|
||||
|
||||
func newCreateCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
options := pluginCreateOptions{}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -74,9 +74,10 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command {
|
|||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
options.repoName = args[0]
|
||||
options.context = args[1]
|
||||
return runCreate(cmd.Context(), dockerCli, options)
|
||||
return runCreate(cmd.Context(), dockerCLI, options)
|
||||
},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ func newDisableCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
_, _ = fmt.Fprintln(dockerCLI.Out(), name)
|
||||
return nil
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func newEnableCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newEnableCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts client.PluginEnableOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -20,12 +20,13 @@ func newEnableCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Args: cli.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
name := args[0]
|
||||
if err := runEnable(cmd.Context(), dockerCli, name, opts); err != nil {
|
||||
if err := runEnable(cmd.Context(), dockerCLI, name, opts); err != nil {
|
||||
return err
|
||||
}
|
||||
_, _ = fmt.Fprintln(dockerCli.Out(), name)
|
||||
_, _ = fmt.Fprintln(dockerCLI.Out(), name)
|
||||
return nil
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ type inspectOptions struct {
|
|||
format string
|
||||
}
|
||||
|
||||
func newInspectCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts inspectOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -27,8 +27,9 @@ func newInspectCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Args: cli.RequiresMinArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
opts.pluginNames = args
|
||||
return runInspect(cmd.Context(), dockerCli, opts)
|
||||
return runInspect(cmd.Context(), dockerCLI, opts)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ type pluginOptions struct {
|
|||
skipRemoteCheck bool
|
||||
}
|
||||
|
||||
func newInstallCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newInstallCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var options pluginOptions
|
||||
cmd := &cobra.Command{
|
||||
Use: "install [OPTIONS] PLUGIN [KEY=VALUE...]",
|
||||
|
|
@ -36,15 +36,16 @@ func newInstallCommand(dockerCli command.Cli) *cobra.Command {
|
|||
if len(args) > 1 {
|
||||
options.args = args[1:]
|
||||
}
|
||||
return runInstall(cmd.Context(), dockerCli, options)
|
||||
return runInstall(cmd.Context(), dockerCLI, options)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
flags.BoolVar(&options.grantPerms, "grant-all-permissions", false, "Grant all permissions necessary to run the plugin")
|
||||
flags.BoolVar(&options.disable, "disable", false, "Do not enable the plugin on install")
|
||||
flags.StringVar(&options.localName, "alias", "", "Local name for plugin")
|
||||
flags.Bool("disable-content-trust", dockerCli.ContentTrustEnabled(), "Skip image verification (deprecated)")
|
||||
flags.Bool("disable-content-trust", dockerCLI.ContentTrustEnabled(), "Skip image verification (deprecated)")
|
||||
_ = flags.MarkHidden("disable-content-trust")
|
||||
return cmd
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ type listOptions struct {
|
|||
filter opts.FilterOpt
|
||||
}
|
||||
|
||||
func newListCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newListCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
options := listOptions{filter: opts.NewFilterOpt()}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -29,9 +29,10 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Aliases: []string{"list"},
|
||||
Args: cli.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runList(cmd.Context(), dockerCli, options)
|
||||
return runList(cmd.Context(), dockerCLI, options)
|
||||
},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ func newPushCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
name := args[0]
|
||||
return runPush(cmd.Context(), dockerCLI, name)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ type rmOptions struct {
|
|||
plugins []string
|
||||
}
|
||||
|
||||
func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var opts rmOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -27,8 +27,9 @@ func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Args: cli.RequiresMinArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
opts.plugins = args
|
||||
return runRemove(cmd.Context(), dockerCli, &opts)
|
||||
return runRemove(cmd.Context(), dockerCLI, &opts)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -6,13 +6,14 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func newSetCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newSetCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "set PLUGIN KEY=VALUE [KEY=VALUE...]",
|
||||
Short: "Change settings for a plugin",
|
||||
Args: cli.RequiresMinArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return dockerCli.Client().PluginSet(cmd.Context(), args[0], args[1:])
|
||||
return dockerCLI.Client().PluginSet(cmd.Context(), args[0], args[1:])
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func newUpgradeCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newUpgradeCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
var options pluginOptions
|
||||
cmd := &cobra.Command{
|
||||
Use: "upgrade [OPTIONS] PLUGIN [REMOTE]",
|
||||
|
|
@ -25,14 +25,15 @@ func newUpgradeCommand(dockerCli command.Cli) *cobra.Command {
|
|||
if len(args) == 2 {
|
||||
options.remote = args[1]
|
||||
}
|
||||
return runUpgrade(cmd.Context(), dockerCli, options)
|
||||
return runUpgrade(cmd.Context(), dockerCLI, options)
|
||||
},
|
||||
Annotations: map[string]string{"version": "1.26"},
|
||||
Annotations: map[string]string{"version": "1.26"},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
flags.BoolVar(&options.grantPerms, "grant-all-permissions", false, "Grant all permissions necessary to run the plugin")
|
||||
flags.Bool("disable-content-trust", dockerCli.ContentTrustEnabled(), "Skip image verification (deprecated)")
|
||||
flags.Bool("disable-content-trust", dockerCLI.ContentTrustEnabled(), "Skip image verification (deprecated)")
|
||||
_ = flags.MarkHidden("disable-content-trust")
|
||||
flags.BoolVar(&options.skipRemoteCheck, "skip-remote-check", false, "Do not check if specified remote plugin matches existing plugin image")
|
||||
return cmd
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ func newLoginCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"category-top": "8",
|
||||
},
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ func newLogoutCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"category-top": "9",
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
// TODO (thaJeztah) add completion for registries we have authentication stored for
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ func newSearchCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
Annotations: map[string]string{
|
||||
"category-top": "10",
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ func newSecretCommand(dockerCLI command.Cli) *cobra.Command {
|
|||
"version": "1.25",
|
||||
"swarm": "manager",
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
cmd.AddCommand(
|
||||
newSecretListCommand(dockerCLI),
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ type createOptions struct {
|
|||
labels opts.ListOpts
|
||||
}
|
||||
|
||||
func newSecretCreateCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newSecretCreateCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
options := createOptions{
|
||||
labels: opts.NewListOpts(opts.ValidateLabel),
|
||||
}
|
||||
|
|
@ -36,8 +36,9 @@ func newSecretCreateCommand(dockerCli command.Cli) *cobra.Command {
|
|||
if len(args) == 2 {
|
||||
options.file = args[1]
|
||||
}
|
||||
return runSecretCreate(cmd.Context(), dockerCli, options)
|
||||
return runSecretCreate(cmd.Context(), dockerCLI, options)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
flags := cmd.Flags()
|
||||
flags.VarP(&options.labels, "label", "l", "Secret labels")
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ type inspectOptions struct {
|
|||
pretty bool
|
||||
}
|
||||
|
||||
func newSecretInspectCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newSecretInspectCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
opts := inspectOptions{}
|
||||
cmd := &cobra.Command{
|
||||
Use: "inspect [OPTIONS] SECRET [SECRET...]",
|
||||
|
|
@ -29,11 +29,12 @@ func newSecretInspectCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Args: cli.RequiresMinArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
opts.names = args
|
||||
return runSecretInspect(cmd.Context(), dockerCli, opts)
|
||||
return runSecretInspect(cmd.Context(), dockerCLI, opts)
|
||||
},
|
||||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
return completeNames(dockerCli)(cmd, args, toComplete)
|
||||
return completeNames(dockerCLI)(cmd, args, toComplete)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
cmd.Flags().StringVarP(&opts.format, "format", "f", "", flagsHelper.InspectFormatHelp)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ type listOptions struct {
|
|||
filter opts.FilterOpt
|
||||
}
|
||||
|
||||
func newSecretListCommand(dockerCli command.Cli) *cobra.Command {
|
||||
func newSecretListCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
options := listOptions{filter: opts.NewFilterOpt()}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
@ -29,11 +29,12 @@ func newSecretListCommand(dockerCli command.Cli) *cobra.Command {
|
|||
Short: "List secrets",
|
||||
Args: cli.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runSecretList(cmd.Context(), dockerCli, options)
|
||||
return runSecretList(cmd.Context(), dockerCLI, options)
|
||||
},
|
||||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
return completeNames(dockerCli)(cmd, args, toComplete)
|
||||
return completeNames(dockerCLI)(cmd, args, toComplete)
|
||||
},
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
flags := cmd.Flags()
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue