Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Commit

Permalink
Hide commands and flag annotated "experimentalCLI"
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
  • Loading branch information
ndeloof committed Nov 12, 2019
1 parent 71d1340 commit 231a1bf
Show file tree
Hide file tree
Showing 34 changed files with 534 additions and 589 deletions.
9 changes: 4 additions & 5 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ required = ["github.com/wadey/gocovmerge"]

[[override]]
name = "github.com/docker/cli"
revision = "6318939f30e01585b34eb6a68a54b890a8d54eb0"
revision = "37f9a88c696ae81be14c1697bd083d6421b4933c"

[[override]]
name = "github.com/deislabs/cnab-go"
Expand All @@ -70,7 +70,7 @@ required = ["github.com/wadey/gocovmerge"]

[[override]]
name = "github.com/xeipuuv/gojsonschema"
version = "v1.2.0"
revision = "f971f3cd73b2899de6923801c147f075263e0c50"

[[override]]
name = "github.com/docker/go-metrics"
Expand Down
18 changes: 18 additions & 0 deletions internal/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,24 @@ func addCommands(cmd *cobra.Command, dockerCli command.Cli) {
build.Cmd(dockerCli),
inspectCmd(dockerCli),
)

if !dockerCli.ClientInfo().HasExperimental {
hideExperimentalFlags(cmd)
}
}

func hideExperimentalFlags(cmd *cobra.Command) {
if _, ok := cmd.Annotations["experimentalCLI"]; ok {
cmd.Hidden = true
}
cmd.Flags().VisitAll(func(f *pflag.Flag) {
if _, ok := f.Annotations["experimentalCLI"]; ok {
f.Hidden = true
}
})
for _, subcmd := range cmd.Commands() {
hideExperimentalFlags(subcmd)
}
}

func firstOrEmpty(list []string) string {
Expand Down
56 changes: 41 additions & 15 deletions vendor/github.com/docker/cli/cli/command/cli.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions vendor/github.com/docker/cli/cli/command/formatter/image.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/docker/cli/cli/command/utils.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/github.com/docker/cli/cli/compose/convert/compose.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 7 additions & 14 deletions vendor/github.com/docker/cli/cli/compose/convert/service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 231a1bf

Please sign in to comment.