flagSource looks up the enum_source for a flag on the given command path. Returns ("", false) when no binding applies.
(path, name string)
| 93 | // flagSource looks up the enum_source for a flag on the given command |
| 94 | // path. Returns ("", false) when no binding applies. |
| 95 | func (r *Resolver) flagSource(path, name string) (string, bool) { |
| 96 | name = strings.ToLower(name) |
| 97 | if specific, ok := r.CommandFlagBindings[path][name]; ok { |
| 98 | return specific, true |
| 99 | } |
| 100 | if global, ok := r.FlagEnumSources[name]; ok { |
| 101 | return global, true |
| 102 | } |
| 103 | return "", false |
| 104 | } |
| 105 | |
| 106 | // Apply walks doc and stamps EnumSource + resolved Enum values on |
| 107 | // matching args and flags. Resolution failures are silent: the document |