This repository was archived by the owner on Jul 18, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ func NewRootCmd(use string, dockerCli command.Cli) *cobra.Command {
4848}
4949
5050func addCommands (cmd * cobra.Command , dockerCli command.Cli ) {
51- cmd . AddCommand (
51+ listOfCommands := [] * cobra. Command {
5252 runCmd (dockerCli ),
5353 updateCmd (dockerCli ),
5454 removeCmd (dockerCli ),
@@ -59,8 +59,19 @@ func addCommands(cmd *cobra.Command, dockerCli command.Cli) {
5959 pullCmd (dockerCli ),
6060 image .Cmd (dockerCli ),
6161 build .Cmd (dockerCli ),
62- inspectCmd (dockerCli ),
63- )
62+ }
63+
64+ isExperimentalMode := dockerCli .ClientInfo ().HasExperimental
65+ for _ , ccmd := range listOfCommands {
66+ switch ccmd .Annotations ["experimental" ] {
67+ case "true" :
68+ if isExperimentalMode {
69+ cmd .AddCommand (ccmd )
70+ }
71+ default :
72+ cmd .AddCommand (ccmd )
73+ }
74+ }
6475}
6576
6677func firstOrEmpty (list []string ) string {
Original file line number Diff line number Diff line change @@ -22,10 +22,11 @@ type validateOptions struct {
2222func validateCmd () * cobra.Command {
2323 var opts validateOptions
2424 cmd := & cobra.Command {
25- Use : "validate [OPTIONS] APP_DEFINITION" ,
26- Short : "Check that an App definition (.dockerapp) is syntactically correct" ,
27- Example : `$ docker app validate myapp.dockerapp --set key=value --parameters-file myparam.yml` ,
28- Args : cli .RequiresMaxArgs (1 ),
25+ Use : "validate [OPTIONS] APP_DEFINITION" ,
26+ Short : "Check that an App definition (.dockerapp) is syntactically correct" ,
27+ Example : `$ docker app validate myapp.dockerapp --set key=value --parameters-file myparam.yml` ,
28+ Args : cli .RequiresMaxArgs (1 ),
29+ Annotations : map [string ]string {"experimental" : "true" },
2930 RunE : func (cmd * cobra.Command , args []string ) error {
3031 return runValidate (args , opts )
3132 },
You can’t perform that action at this time.
0 commit comments