Flag is a common interface related to parsing flags in cli. For more advanced flag parsing techniques, it is recommended that this interface be implemented.
| 89 | // For more advanced flag parsing techniques, it is recommended that |
| 90 | // this interface be implemented. |
| 91 | type Flag interface { |
| 92 | fmt.Stringer |
| 93 | |
| 94 | // Retrieve the value of the Flag |
| 95 | Get() any |
| 96 | |
| 97 | // Lifecycle methods. |
| 98 | // flag callback prior to parsing |
| 99 | PreParse() error |
| 100 | |
| 101 | // flag callback post parsing |
| 102 | PostParse() error |
| 103 | |
| 104 | // Apply Flag settings to the given flag set |
| 105 | Set(string, string) error |
| 106 | |
| 107 | // All possible names for this flag |
| 108 | Names() []string |
| 109 | |
| 110 | // Whether the flag has been set or not |
| 111 | IsSet() bool |
| 112 | } |
| 113 | |
| 114 | // RequiredFlag is an interface that allows us to mark flags as required |
| 115 | // it allows flags required flags to be backwards compatible with the Flag interface |
no outgoing calls
no test coverage detected