cli/command/*: remove deprecated cobra command constructors

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-08-21 11:12:28 +02:00
parent 942a6c4c76
commit 873609d790
61 changed files with 40 additions and 436 deletions

View File

@ -40,13 +40,7 @@ func inspectContainerAndCheckState(ctx context.Context, apiClient client.APIClie
return &c, nil
}
// NewAttachCommand creates a new cobra.Command for `docker attach`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewAttachCommand(dockerCLI command.Cli) *cobra.Command {
return newAttachCommand(dockerCLI)
}
// newAttachCommand creates a new cobra.Command for `docker attach`
func newAttachCommand(dockerCLI command.Cli) *cobra.Command {
var opts AttachOptions

View File

@ -34,13 +34,7 @@ func init() {
commands.RegisterLegacy(newWaitCommand)
}
// NewContainerCommand returns a cobra command for `container` subcommands
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewContainerCommand(dockerCLI command.Cli) *cobra.Command {
return newContainerCommand(dockerCLI)
}
// newContainerCommand returns a cobra command for `container` subcommands
func newContainerCommand(dockerCLI command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "container",

View File

@ -22,13 +22,7 @@ type commitOptions struct {
changes opts.ListOpts
}
// NewCommitCommand creates a new cobra.Command for `docker commit`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewCommitCommand(dockerCLI command.Cli) *cobra.Command {
return newCommitCommand(dockerCLI)
}
// newCommitCommand creates a new cobra.Command for `docker commit`
func newCommitCommand(dockerCLI command.Cli) *cobra.Command {
var options commitOptions

View File

@ -121,13 +121,7 @@ func copyProgress(ctx context.Context, dst io.Writer, header string, total *int6
return restore, done
}
// NewCopyCommand creates a new `docker cp` command
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewCopyCommand(dockerCLI command.Cli) *cobra.Command {
return newCopyCommand(dockerCLI)
}
// newCopyCommand creates a new `docker cp` command
func newCopyCommand(dockerCLI command.Cli) *cobra.Command {
var opts copyOptions

View File

@ -51,13 +51,7 @@ type createOptions struct {
useAPISocket bool
}
// NewCreateCommand creates a new cobra.Command for `docker create`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewCreateCommand(dockerCLI command.Cli) *cobra.Command {
return newCreateCommand(dockerCLI)
}
// newCreateCommand creates a new cobra.Command for `docker create`
func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
var options createOptions
var copts *containerOptions

View File

@ -10,13 +10,7 @@ import (
"github.com/spf13/cobra"
)
// NewDiffCommand creates a new cobra.Command for `docker diff`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewDiffCommand(dockerCLI command.Cli) *cobra.Command {
return newDiffCommand(dockerCLI)
}
// newDiffCommand creates a new cobra.Command for `docker diff`
func newDiffCommand(dockerCLI command.Cli) *cobra.Command {
return &cobra.Command{
Use: "diff CONTAINER",

View File

@ -39,13 +39,7 @@ func NewExecOptions() ExecOptions {
}
}
// NewExecCommand creates a new cobra.Command for `docker exec`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewExecCommand(dockerCLI command.Cli) *cobra.Command {
return newExecCommand(dockerCLI)
}
// newExecCommand creates a new cobra.Command for "docker exec".
func newExecCommand(dockerCLI command.Cli) *cobra.Command {
options := NewExecOptions()

View File

@ -17,13 +17,7 @@ type exportOptions struct {
output string
}
// NewExportCommand creates a new `docker export` command
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewExportCommand(dockerCLI command.Cli) *cobra.Command {
return newExportCommand(dockerCLI)
}
// newExportCommand creates a new "docker container export" command.
func newExportCommand(dockerCLI command.Cli) *cobra.Command {
var opts exportOptions

View File

@ -17,13 +17,7 @@ type killOptions struct {
containers []string
}
// NewKillCommand creates a new cobra.Command for `docker kill`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewKillCommand(dockerCLI command.Cli) *cobra.Command {
return newKillCommand(dockerCLI)
}
// newKillCommand creates a new cobra.Command for "docker container kill"
func newKillCommand(dockerCLI command.Cli) *cobra.Command {
var opts killOptions

View File

@ -28,13 +28,7 @@ type psOptions struct {
filter opts.FilterOpt
}
// NewPsCommand creates a new cobra.Command for `docker ps`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewPsCommand(dockerCLI command.Cli) *cobra.Command {
return newPsCommand(dockerCLI)
}
// newPsCommand creates a new cobra.Command for "docker container ps"
func newPsCommand(dockerCLI command.Cli) *cobra.Command {
options := psOptions{filter: opts.NewFilterOpt()}

View File

@ -23,13 +23,7 @@ type logsOptions struct {
container string
}
// NewLogsCommand creates a new cobra.Command for `docker logs`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewLogsCommand(dockerCLI command.Cli) *cobra.Command {
return newLogsCommand(dockerCLI)
}
// newLogsCommand creates a new cobra.Command for "docker container logs"
func newLogsCommand(dockerCLI command.Cli) *cobra.Command {
var opts logsOptions

View File

@ -16,13 +16,7 @@ type pauseOptions struct {
containers []string
}
// NewPauseCommand creates a new cobra.Command for `docker pause`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewPauseCommand(dockerCLI command.Cli) *cobra.Command {
return newPauseCommand(dockerCLI)
}
// newPauseCommand creates a new cobra.Command for "docker container pause"
func newPauseCommand(dockerCLI command.Cli) *cobra.Command {
var opts pauseOptions

View File

@ -23,13 +23,7 @@ type portOptions struct {
port string
}
// NewPortCommand creates a new cobra.Command for `docker port`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewPortCommand(dockerCli command.Cli) *cobra.Command {
return newPortCommand(dockerCli)
}
// newPortCommand creates a new cobra.Command for "docker container port".
func newPortCommand(dockerCli command.Cli) *cobra.Command {
var opts portOptions

View File

@ -27,13 +27,7 @@ type pruneOptions struct {
filter opts.FilterOpt
}
// NewPruneCommand returns a new cobra prune command for containers
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewPruneCommand(dockerCLI command.Cli) *cobra.Command {
return newPruneCommand(dockerCLI)
}
// newPruneCommand returns a new cobra prune command for containers.
func newPruneCommand(dockerCLI command.Cli) *cobra.Command {
options := pruneOptions{filter: opts.NewFilterOpt()}

View File

@ -17,13 +17,7 @@ type renameOptions struct {
newName string
}
// NewRenameCommand creates a new cobra.Command for `docker rename`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewRenameCommand(dockerCLI command.Cli) *cobra.Command {
return newRenameCommand(dockerCLI)
}
// newRenameCommand creates a new cobra.Command for "docker container rename".
func newRenameCommand(dockerCLI command.Cli) *cobra.Command {
var opts renameOptions

View File

@ -20,13 +20,7 @@ type restartOptions struct {
containers []string
}
// NewRestartCommand creates a new cobra.Command for `docker restart`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewRestartCommand(dockerCLI command.Cli) *cobra.Command {
return newRestartCommand(dockerCLI)
}
// newRestartCommand creates a new cobra.Command for "docker container restart".
func newRestartCommand(dockerCLI command.Cli) *cobra.Command {
var opts restartOptions

View File

@ -22,13 +22,7 @@ type rmOptions struct {
containers []string
}
// NewRmCommand creates a new cobra.Command for `docker rm`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewRmCommand(dockerCLI command.Cli) *cobra.Command {
return newRmCommand(dockerCLI)
}
// newRmCommand creates a new cobra.Command for "docker container rm".
func newRmCommand(dockerCLI command.Cli) *cobra.Command {
var opts rmOptions

View File

@ -27,13 +27,7 @@ type runOptions struct {
detachKeys string
}
// NewRunCommand create a new `docker run` command
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewRunCommand(dockerCLI command.Cli) *cobra.Command {
return newRunCommand(dockerCLI)
}
// newRunCommand create a new "docker run" command.
func newRunCommand(dockerCLI command.Cli) *cobra.Command {
var options runOptions
var copts *containerOptions

View File

@ -27,13 +27,7 @@ type StartOptions struct {
Containers []string
}
// NewStartCommand creates a new cobra.Command for `docker start`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewStartCommand(dockerCli command.Cli) *cobra.Command {
return newStartCommand(dockerCli)
}
// newStartCommand creates a new cobra.Command for "docker container start".
func newStartCommand(dockerCli command.Cli) *cobra.Command {
var opts StartOptions

View File

@ -63,13 +63,7 @@ type StatsOptions struct {
Filters *filters.Args
}
// NewStatsCommand creates a new [cobra.Command] for "docker stats".
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewStatsCommand(dockerCLI command.Cli) *cobra.Command {
return newStatsCommand(dockerCLI)
}
// newStatsCommand creates a new [cobra.Command] for "docker container stats".
func newStatsCommand(dockerCLI command.Cli) *cobra.Command {
options := StatsOptions{}

View File

@ -20,13 +20,7 @@ type stopOptions struct {
containers []string
}
// NewStopCommand creates a new cobra.Command for `docker stop`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewStopCommand(dockerCLI command.Cli) *cobra.Command {
return newStopCommand(dockerCLI)
}
// newStopCommand creates a new cobra.Command for "docker container stop".
func newStopCommand(dockerCLI command.Cli) *cobra.Command {
var opts stopOptions

View File

@ -18,13 +18,7 @@ type topOptions struct {
args []string
}
// NewTopCommand creates a new cobra.Command for `docker top`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewTopCommand(dockerCLI command.Cli) *cobra.Command {
return newTopCommand(dockerCLI)
}
// newTopCommand creates a new cobra.Command for "docker container top",
func newTopCommand(dockerCLI command.Cli) *cobra.Command {
var opts topOptions

View File

@ -16,13 +16,7 @@ type unpauseOptions struct {
containers []string
}
// NewUnpauseCommand creates a new cobra.Command for `docker unpause`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewUnpauseCommand(dockerCli command.Cli) *cobra.Command {
return newUnpauseCommand(dockerCli)
}
// newUnpauseCommand creates a new cobra.Command for "docker container unpause".
func newUnpauseCommand(dockerCli command.Cli) *cobra.Command {
var opts unpauseOptions

View File

@ -36,13 +36,7 @@ type updateOptions struct {
containers []string
}
// NewUpdateCommand creates a new cobra.Command for `docker update`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewUpdateCommand(dockerCLI command.Cli) *cobra.Command {
return newUpdateCommand(dockerCLI)
}
// newUpdateCommand creates a new cobra.Command for "docker container update".
func newUpdateCommand(dockerCLI command.Cli) *cobra.Command {
var options updateOptions

View File

@ -15,13 +15,7 @@ type waitOptions struct {
containers []string
}
// NewWaitCommand creates a new cobra.Command for `docker wait`
//
// Deprecated: Do not import commands directly. They will be removed in a future release.
func NewWaitCommand(dockerCLI command.Cli) *cobra.Command {
return newWaitCommand(dockerCLI)
}
// newWaitCommand creates a new cobra.Command for "docker container wait".
func newWaitCommand(dockerCLI command.Cli) *cobra.Command {
var opts waitOptions