(f *pflag.Flag, condition func(string) bool, annotation string)
| 568 | } |
| 569 | |
| 570 | func hideFlagIf(f *pflag.Flag, condition func(string) bool, annotation string) { |
| 571 | if f.Hidden { |
| 572 | return |
| 573 | } |
| 574 | var val string |
| 575 | if values, ok := f.Annotations[annotation]; ok { |
| 576 | if len(values) > 0 { |
| 577 | val = values[0] |
| 578 | } |
| 579 | if condition(val) { |
| 580 | f.Hidden = true |
| 581 | } |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | func hideSubcommandIf(subcmd *cobra.Command, condition func(string) bool, annotation string) { |
| 586 | if subcmd.Hidden { |
no outgoing calls
no test coverage detected
searching dependent graphs…