mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Show experimental flags and subcommands if enabled
Signed-off-by: John Stephens <johnstep@docker.com>
This commit is contained in:
parent
75fd88ba89
commit
16d4e6395e
1 changed files with 8 additions and 4 deletions
|
@ -126,8 +126,10 @@ func dockerPreRun(opts *cliflags.ClientOptions) {
|
|||
func hideUnsupportedFeatures(cmd *cobra.Command, clientVersion string, hasExperimental bool) {
|
||||
cmd.Flags().VisitAll(func(f *pflag.Flag) {
|
||||
// hide experimental flags
|
||||
if _, ok := f.Annotations["experimental"]; ok {
|
||||
f.Hidden = true
|
||||
if !hasExperimental {
|
||||
if _, ok := f.Annotations["experimental"]; ok {
|
||||
f.Hidden = true
|
||||
}
|
||||
}
|
||||
|
||||
// hide flags not supported by the server
|
||||
|
@ -139,8 +141,10 @@ func hideUnsupportedFeatures(cmd *cobra.Command, clientVersion string, hasExperi
|
|||
|
||||
for _, subcmd := range cmd.Commands() {
|
||||
// hide experimental subcommands
|
||||
if _, ok := subcmd.Tags["experimental"]; ok {
|
||||
subcmd.Hidden = true
|
||||
if !hasExperimental {
|
||||
if _, ok := subcmd.Tags["experimental"]; ok {
|
||||
subcmd.Hidden = true
|
||||
}
|
||||
}
|
||||
|
||||
// hide subcommands not supported by the server
|
||||
|
|
Loading…
Reference in a new issue