mirror of https://github.com/docker/cli.git
Show experimental flags and subcommands if enabled
Signed-off-by: John Stephens <johnstep@docker.com>
This commit is contained in:
parent
076bfc0647
commit
13d6a1bb67
12
docker.go
12
docker.go
|
@ -126,8 +126,10 @@ func dockerPreRun(opts *cliflags.ClientOptions) {
|
||||||
func hideUnsupportedFeatures(cmd *cobra.Command, clientVersion string, hasExperimental bool) {
|
func hideUnsupportedFeatures(cmd *cobra.Command, clientVersion string, hasExperimental bool) {
|
||||||
cmd.Flags().VisitAll(func(f *pflag.Flag) {
|
cmd.Flags().VisitAll(func(f *pflag.Flag) {
|
||||||
// hide experimental flags
|
// hide experimental flags
|
||||||
if _, ok := f.Annotations["experimental"]; ok {
|
if !hasExperimental {
|
||||||
f.Hidden = true
|
if _, ok := f.Annotations["experimental"]; ok {
|
||||||
|
f.Hidden = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide flags not supported by the server
|
// hide flags not supported by the server
|
||||||
|
@ -139,8 +141,10 @@ func hideUnsupportedFeatures(cmd *cobra.Command, clientVersion string, hasExperi
|
||||||
|
|
||||||
for _, subcmd := range cmd.Commands() {
|
for _, subcmd := range cmd.Commands() {
|
||||||
// hide experimental subcommands
|
// hide experimental subcommands
|
||||||
if _, ok := subcmd.Tags["experimental"]; ok {
|
if !hasExperimental {
|
||||||
subcmd.Hidden = true
|
if _, ok := subcmd.Tags["experimental"]; ok {
|
||||||
|
subcmd.Hidden = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide subcommands not supported by the server
|
// hide subcommands not supported by the server
|
||||||
|
|
Loading…
Reference in New Issue