ShorthandLookup returns the Flag structure of the short handed flag, returning nil if none exists. It panics, if len(name) > 1.
(name string)
| 383 | // returning nil if none exists. |
| 384 | // It panics, if len(name) > 1. |
| 385 | func (f *FlagSet) ShorthandLookup(name string) *Flag { |
| 386 | if name == "" { |
| 387 | return nil |
| 388 | } |
| 389 | if len(name) > 1 { |
| 390 | msg := fmt.Sprintf("can not look up shorthand which is more than one ASCII character: %q", name) |
| 391 | fmt.Fprintf(f.Output(), msg) |
| 392 | panic(msg) |
| 393 | } |
| 394 | c := name[0] |
| 395 | return f.shorthands[c] |
| 396 | } |
| 397 | |
| 398 | // lookup returns the Flag structure of the named flag, returning nil if none exists. |
| 399 | func (f *FlagSet) lookup(name NormalizedName) *Flag { |