2016-09-08 13:11:39 -04:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
2016-09-12 11:37:00 -04:00
|
|
|
"os"
|
|
|
|
|
2016-09-08 13:11:39 -04:00
|
|
|
"github.com/docker/docker/cli/command"
|
2016-05-12 10:52:00 -04:00
|
|
|
"github.com/docker/docker/cli/command/checkpoint"
|
2016-09-08 13:11:39 -04:00
|
|
|
"github.com/docker/docker/cli/command/container"
|
|
|
|
"github.com/docker/docker/cli/command/image"
|
|
|
|
"github.com/docker/docker/cli/command/network"
|
|
|
|
"github.com/docker/docker/cli/command/node"
|
|
|
|
"github.com/docker/docker/cli/command/plugin"
|
|
|
|
"github.com/docker/docker/cli/command/registry"
|
2016-10-19 12:22:02 -04:00
|
|
|
"github.com/docker/docker/cli/command/secret"
|
2016-09-08 13:11:39 -04:00
|
|
|
"github.com/docker/docker/cli/command/service"
|
|
|
|
"github.com/docker/docker/cli/command/stack"
|
|
|
|
"github.com/docker/docker/cli/command/swarm"
|
|
|
|
"github.com/docker/docker/cli/command/system"
|
|
|
|
"github.com/docker/docker/cli/command/volume"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2016-09-08 14:54:01 -04:00
|
|
|
// AddCommands adds all the commands from cli/command to the root command
|
2016-09-08 13:11:39 -04:00
|
|
|
func AddCommands(cmd *cobra.Command, dockerCli *command.DockerCli) {
|
|
|
|
cmd.AddCommand(
|
|
|
|
node.NewNodeCommand(dockerCli),
|
|
|
|
service.NewServiceCommand(dockerCli),
|
|
|
|
swarm.NewSwarmCommand(dockerCli),
|
2016-10-19 12:22:02 -04:00
|
|
|
secret.NewSecretCommand(dockerCli),
|
2016-06-23 13:03:40 -04:00
|
|
|
container.NewContainerCommand(dockerCli),
|
|
|
|
image.NewImageCommand(dockerCli),
|
2016-09-19 13:38:58 -04:00
|
|
|
system.NewSystemCommand(dockerCli),
|
2016-09-08 13:11:39 -04:00
|
|
|
container.NewRunCommand(dockerCli),
|
|
|
|
image.NewBuildCommand(dockerCli),
|
|
|
|
network.NewNetworkCommand(dockerCli),
|
2016-09-19 13:38:58 -04:00
|
|
|
hide(system.NewEventsCommand(dockerCli)),
|
2016-09-08 13:11:39 -04:00
|
|
|
registry.NewLoginCommand(dockerCli),
|
|
|
|
registry.NewLogoutCommand(dockerCli),
|
2016-08-29 09:59:41 -04:00
|
|
|
registry.NewSearchCommand(dockerCli),
|
2016-09-08 13:11:39 -04:00
|
|
|
system.NewVersionCommand(dockerCli),
|
|
|
|
volume.NewVolumeCommand(dockerCli),
|
2016-09-19 13:38:58 -04:00
|
|
|
hide(system.NewInfoCommand(dockerCli)),
|
2016-06-23 13:03:40 -04:00
|
|
|
hide(container.NewAttachCommand(dockerCli)),
|
|
|
|
hide(container.NewCommitCommand(dockerCli)),
|
|
|
|
hide(container.NewCopyCommand(dockerCli)),
|
|
|
|
hide(container.NewCreateCommand(dockerCli)),
|
|
|
|
hide(container.NewDiffCommand(dockerCli)),
|
|
|
|
hide(container.NewExecCommand(dockerCli)),
|
|
|
|
hide(container.NewExportCommand(dockerCli)),
|
|
|
|
hide(container.NewKillCommand(dockerCli)),
|
|
|
|
hide(container.NewLogsCommand(dockerCli)),
|
|
|
|
hide(container.NewPauseCommand(dockerCli)),
|
|
|
|
hide(container.NewPortCommand(dockerCli)),
|
|
|
|
hide(container.NewPsCommand(dockerCli)),
|
|
|
|
hide(container.NewRenameCommand(dockerCli)),
|
|
|
|
hide(container.NewRestartCommand(dockerCli)),
|
|
|
|
hide(container.NewRmCommand(dockerCli)),
|
|
|
|
hide(container.NewStartCommand(dockerCli)),
|
|
|
|
hide(container.NewStatsCommand(dockerCli)),
|
|
|
|
hide(container.NewStopCommand(dockerCli)),
|
|
|
|
hide(container.NewTopCommand(dockerCli)),
|
|
|
|
hide(container.NewUnpauseCommand(dockerCli)),
|
|
|
|
hide(container.NewUpdateCommand(dockerCli)),
|
|
|
|
hide(container.NewWaitCommand(dockerCli)),
|
|
|
|
hide(image.NewHistoryCommand(dockerCli)),
|
|
|
|
hide(image.NewImagesCommand(dockerCli)),
|
|
|
|
hide(image.NewImportCommand(dockerCli)),
|
|
|
|
hide(image.NewLoadCommand(dockerCli)),
|
|
|
|
hide(image.NewPullCommand(dockerCli)),
|
|
|
|
hide(image.NewPushCommand(dockerCli)),
|
|
|
|
hide(image.NewRemoveCommand(dockerCli)),
|
|
|
|
hide(image.NewSaveCommand(dockerCli)),
|
|
|
|
hide(image.NewTagCommand(dockerCli)),
|
|
|
|
hide(system.NewInspectCommand(dockerCli)),
|
2016-11-02 20:43:32 -04:00
|
|
|
stack.NewStackCommand(dockerCli),
|
|
|
|
stack.NewTopLevelDeployCommand(dockerCli),
|
|
|
|
checkpoint.NewCheckpointCommand(dockerCli),
|
|
|
|
plugin.NewPluginCommand(dockerCli),
|
2016-09-08 13:11:39 -04:00
|
|
|
)
|
2016-10-06 10:09:54 -04:00
|
|
|
|
2016-09-08 13:11:39 -04:00
|
|
|
}
|
2016-06-23 13:03:40 -04:00
|
|
|
|
|
|
|
func hide(cmd *cobra.Command) *cobra.Command {
|
2016-09-12 11:37:00 -04:00
|
|
|
if os.Getenv("DOCKER_HIDE_LEGACY_COMMANDS") == "" {
|
|
|
|
return cmd
|
|
|
|
}
|
2016-06-23 13:03:40 -04:00
|
|
|
cmdCopy := *cmd
|
|
|
|
cmdCopy.Hidden = true
|
|
|
|
cmdCopy.Aliases = []string{}
|
|
|
|
return &cmdCopy
|
|
|
|
}
|