MarkShorthandDeprecated will mark the shorthand of a flag deprecated in your program. It will continue to function but will not show up in help or usage messages. Using this flag will also print the given usageMessage.
(name string, usageMessage string)
| 448 | // program. It will continue to function but will not show up in help or usage |
| 449 | // messages. Using this flag will also print the given usageMessage. |
| 450 | func (f *FlagSet) MarkShorthandDeprecated(name string, usageMessage string) error { |
| 451 | flag := f.Lookup(name) |
| 452 | if flag == nil { |
| 453 | return &NotExistError{name: name, messageType: flagNotExistMessage} |
| 454 | } |
| 455 | if usageMessage == "" { |
| 456 | return fmt.Errorf("deprecated message for flag %q must be set", name) |
| 457 | } |
| 458 | flag.ShorthandDeprecated = usageMessage |
| 459 | return nil |
| 460 | } |
| 461 | |
| 462 | // MarkHidden sets a flag to 'hidden' in your program. It will continue to |
| 463 | // function but will not show up in help or usage messages. |