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 {
if cli.hasExperimental == nil {
if cli.client == nil {
cli.Initialize(cliflags.NewClientOptions())
return false
}
enabled := false
cli.hasExperimental = &enabled

View File

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

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.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.checkpointDir, "checkpoint-dir", "", "Use a custom checkpoint storage directory")
}
flags.StringVar(&opts.checkpoint, "checkpoint", "", "Restore from this checkpoint")
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
}

View File

@ -111,9 +111,8 @@ func NewBuildCommand(dockerCli *command.DockerCli) *cobra.Command {
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
}