always add but hide experimental cmds and flags

Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
Victor Vieux 2016-11-02 17:43:32 -07:00
parent 284e11ba2b
commit eb522dac24
4 changed files with 11 additions and 18 deletions

View File

@ -45,7 +45,7 @@ type DockerCli struct {
func (cli *DockerCli) HasExperimental() bool { func (cli *DockerCli) HasExperimental() bool {
if cli.hasExperimental == nil { if cli.hasExperimental == nil {
if cli.client == nil { if cli.client == nil {
cli.Initialize(cliflags.NewClientOptions()) return false
} }
enabled := false enabled := false
cli.hasExperimental = &enabled cli.hasExperimental = &enabled

View File

@ -70,16 +70,11 @@ func AddCommands(cmd *cobra.Command, dockerCli *command.DockerCli) {
hide(image.NewSaveCommand(dockerCli)), hide(image.NewSaveCommand(dockerCli)),
hide(image.NewTagCommand(dockerCli)), hide(image.NewTagCommand(dockerCli)),
hide(system.NewInspectCommand(dockerCli)), hide(system.NewInspectCommand(dockerCli)),
)
if dockerCli.HasExperimental() {
cmd.AddCommand(
stack.NewStackCommand(dockerCli), stack.NewStackCommand(dockerCli),
stack.NewTopLevelDeployCommand(dockerCli), stack.NewTopLevelDeployCommand(dockerCli),
checkpoint.NewCheckpointCommand(dockerCli), checkpoint.NewCheckpointCommand(dockerCli),
plugin.NewPluginCommand(dockerCli), plugin.NewPluginCommand(dockerCli),
) )
}
} }

View File

@ -45,11 +45,10 @@ func NewStartCommand(dockerCli *command.DockerCli) *cobra.Command {
flags.BoolVarP(&opts.openStdin, "interactive", "i", false, "Attach container's STDIN") flags.BoolVarP(&opts.openStdin, "interactive", "i", false, "Attach container's STDIN")
flags.StringVar(&opts.detachKeys, "detach-keys", "", "Override the key sequence for detaching a container") flags.StringVar(&opts.detachKeys, "detach-keys", "", "Override the key sequence for detaching a container")
if dockerCli.HasExperimental() {
flags.StringVar(&opts.checkpoint, "checkpoint", "", "Restore from this checkpoint") flags.StringVar(&opts.checkpoint, "checkpoint", "", "Restore from this checkpoint")
flags.StringVar(&opts.checkpointDir, "checkpoint-dir", "", "Use a custom checkpoint storage directory") flags.StringVar(&opts.checkpointDir, "checkpoint-dir", "", "Use a custom checkpoint storage directory")
} flags.SetAnnotation("checkpoint", "experimental", nil)
flags.SetAnnotation("checkpoint-dir", "experimental", nil)
return cmd return cmd
} }

View File

@ -111,9 +111,8 @@ func NewBuildCommand(dockerCli *command.DockerCli) *cobra.Command {
command.AddTrustedFlags(flags, true) command.AddTrustedFlags(flags, true)
if dockerCli.HasExperimental() {
flags.BoolVar(&options.squash, "squash", false, "Squash newly built layers into a single new layer") flags.BoolVar(&options.squash, "squash", false, "Squash newly built layers into a single new layer")
} flags.SetAnnotation("squash", "experimental", nil)
return cmd return cmd
} }