| 1 | package cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.22 context/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.22 fmt/" |
| 6 | "slicesscip-go gomod github.com/golang/go/src go1.22 slices/" |
| 7 | "stringsscip-go gomod github.com/golang/go/src go1.22 strings/" |
| 8 | "timescip-go gomod github.com/golang/go/src go1.22 time/" |
| 9 | ) |
| 10 | |
| 11 | const defaultPlaceholderscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/defaultPlaceholder. = "value" |
| 12 | |
| 13 | const ( |
| 14 | defaultSliceFlagSeparatorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/defaultSliceFlagSeparator. = "," |
| 15 | defaultMapFlagKeyValueSeparatorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/defaultMapFlagKeyValueSeparator. = "=" |
| 16 | disableSliceFlagSeparatorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/disableSliceFlagSeparator. = false |
| 17 | ) |
| 18 | |
| 19 | var slPfxscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/slPfx. = fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.22 fmt/Sprintf().("sl:::%d:::", timescip-go gomod github.com/golang/go/src go1.22 time/.Nowscip-go gomod github.com/golang/go/src go1.22 time/Now().().UTCscip-go gomod github.com/golang/go/src go1.22 time/Time#UTC().().UnixNanoscip-go gomod github.com/golang/go/src go1.22 time/Time#UnixNano().()) |
| 20 | |
| 21 | // GenerateShellCompletionFlag enables shell completion |
| 22 | var GenerateShellCompletionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/GenerateShellCompletionFlag. Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag# = &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{ |
| 23 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "generate-shell-completion", |
| 24 | Hiddenscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Hidden.: true, |
| 25 | } |
| 26 | |
| 27 | // VersionFlag prints the version for the application |
| 28 | var VersionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/VersionFlag. Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag# = &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{ |
| 29 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "version", |
| 30 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"v"}, |
| 31 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Usage.: "print the version", |
| 32 | HideDefaultscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#HideDefault.: true, |
| 33 | Localscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Local.: true, |
| 34 | } |
| 35 | |
| 36 | // HelpFlag prints the help for all commands and subcommands. |
| 37 | // Set to nil to disable the flag. The subcommand |
| 38 | // will still be added unless HideHelp or HideHelpCommand is set to true. |
| 39 | var HelpFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpFlag. Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag# = &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{ |
| 40 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "help", |
| 41 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"h"}, |
| 42 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Usage.: "show help", |
| 43 | HideDefaultscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#HideDefault.: true, |
| 44 | Localscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Local.: true, |
| 45 | } |
| 46 | |
| 47 | // FlagStringer converts a flag definition to a string. This is used by help |
| 48 | // to display a flag. |
| 49 | var FlagStringerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagStringer. FlagStringFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagStringFunc# = stringifyFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/stringifyFlag(). |
| 50 | |
| 51 | // Serializer is used to circumvent the limitations of flag.FlagSet.Set |
| 52 | type Serializerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Serializer# interface { |
| 53 | Serializescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Serializer#Serialize.() string |
| 54 | } |
| 55 | |
| 56 | // FlagNamePrefixer converts a full flag name and its placeholder into the help |
| 57 | // message flag prefix. This is used by the default FlagStringer. |
| 58 | var FlagNamePrefixerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagNamePrefixer. FlagNamePrefixFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagNamePrefixFunc# = prefixedNamesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/prefixedNames(). |
| 59 | |
| 60 | // FlagEnvHinter annotates flag help message with the environment variable |
| 61 | // details. This is used by the default FlagStringer. |
| 62 | var FlagEnvHinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagEnvHinter. FlagEnvHintFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagEnvHintFunc# = withEnvHintscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/withEnvHint(). |
| 63 | |
| 64 | // FlagFileHinter annotates flag help message with the environment variable |
| 65 | // details. This is used by the default FlagStringer. |
| 66 | var FlagFileHinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagFileHinter. FlagFileHintFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagFileHintFunc# = withFileHintscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/withFileHint(). |
| 67 | |
| 68 | // FlagsByName is a slice of Flag. |
| 69 | type FlagsByNamescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagsByName# []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag# |
| 70 | |
| 71 | func (f FlagsByNamescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagsByName#) Lenscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagsByName#Len().() int { |
| 72 | return len(f) |
| 73 | } |
| 74 | |
| 75 | func (f FlagsByNamescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagsByName#) Lessscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagsByName#Less().(i, j int) bool { |
| 76 | return lexicographicLessscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/lexicographicLess().(f[i].Namesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#Names.()[0], f[j].Namesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#Names.()[0]) |
| 77 | } |
| 78 | |
| 79 | func (f FlagsByNamescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagsByName#) Swapscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagsByName#Swap().(i, j int) { |
| 80 | f[i], f[j] = f[j], f[i] |
| 81 | } |
| 82 | |
| 83 | // ActionableFlag is an interface that wraps Flag interface and RunAction operation. |
| 84 | type ActionableFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ActionableFlag# interface { |
| 85 | RunActionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ActionableFlag#RunAction.(contextscip-go gomod github.com/golang/go/src go1.22 context/.Contextscip-go gomod github.com/golang/go/src go1.22 context/Context#, *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error |
| 86 | } |
| 87 | |
| 88 | // Flag is a common interface related to parsing flags in cli. |
| 89 | // For more advanced flag parsing techniques, it is recommended that |
| 90 | // this interface be implemented. |
| 91 | type Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag# interface { |
| 92 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Stringerscip-go gomod github.com/golang/go/src go1.22 fmt/Stringer# |
| 93 | |
| 94 | // Retrieve the value of the Flag |
| 95 | Getscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#Get.() any |
| 96 | |
| 97 | // Lifecycle methods. |
| 98 | // flag callback prior to parsing |
| 99 | PreParsescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#PreParse.() error |
| 100 | |
| 101 | // flag callback post parsing |
| 102 | PostParsescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#PostParse.() error |
| 103 | |
| 104 | // Apply Flag settings to the given flag set |
| 105 | Setscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#Set.(string, string) error |
| 106 | |
| 107 | // All possible names for this flag |
| 108 | Namesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#Names.() []string |
| 109 | |
| 110 | // Whether the flag has been set or not |
| 111 | IsSetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#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 |
| 116 | type RequiredFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/RequiredFlag# interface { |
| 117 | // whether the flag is a required flag or not |
| 118 | IsRequiredscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/RequiredFlag#IsRequired.() bool |
| 119 | } |
| 120 | |
| 121 | // DocGenerationFlag is an interface that allows documentation generation for the flag |
| 122 | type DocGenerationFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DocGenerationFlag# interface { |
| 123 | // TakesValue returns true if the flag takes a value, otherwise false |
| 124 | TakesValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DocGenerationFlag#TakesValue.() bool |
| 125 | |
| 126 | // GetUsage returns the usage string for the flag |
| 127 | GetUsagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DocGenerationFlag#GetUsage.() string |
| 128 | |
| 129 | // GetValue returns the flags value as string representation and an empty |
| 130 | // string if the flag takes no value at all. |
| 131 | GetValuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DocGenerationFlag#GetValue.() string |
| 132 | |
| 133 | // GetDefaultText returns the default text for this flag |
| 134 | GetDefaultTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DocGenerationFlag#GetDefaultText.() string |
| 135 | |
| 136 | // GetEnvVars returns the env vars for this flag |
| 137 | GetEnvVarsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DocGenerationFlag#GetEnvVars.() []string |
| 138 | |
| 139 | // IsDefaultVisible returns whether the default value should be shown in |
| 140 | // help text |
| 141 | IsDefaultVisiblescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DocGenerationFlag#IsDefaultVisible.() bool |
| 142 | // TypeName to detect if a flag is a string, bool, etc. |
| 143 | TypeNamescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DocGenerationFlag#TypeName.() string |
| 144 | } |
| 145 | |
| 146 | // DocGenerationMultiValueFlag extends DocGenerationFlag for slice/map based flags. |
| 147 | type DocGenerationMultiValueFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DocGenerationMultiValueFlag# interface { |
| 148 | DocGenerationFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DocGenerationFlag# |
| 149 | |
| 150 | // IsMultiValueFlag returns true for flags that can be given multiple times. |
| 151 | IsMultiValueFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DocGenerationMultiValueFlag#IsMultiValueFlag.() bool |
| 152 | } |
| 153 | |
| 154 | // SchemaTyper is an optional interface for flags that can report their |
| 155 | // JSON Schema type for programmatic introspection. |
| 156 | type SchemaTyperscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/SchemaTyper# interface { |
| 157 | // SchemaType returns the JSON Schema type name for the value this |
| 158 | // flag accepts: "boolean", "integer", "number", "string", "array", |
| 159 | // "object". Returns "" if the flag does not map cleanly. |
| 160 | SchemaTypescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/SchemaTyper#SchemaType.() string |
| 161 | } |
| 162 | |
| 163 | // SchemaItemsTyper is an optional interface for multi-value flags that |
| 164 | // can report the JSON Schema type of their elements. |
| 165 | type SchemaItemsTyperscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/SchemaItemsTyper# interface { |
| 166 | // SchemaItemsType returns the JSON Schema type of elements for |
| 167 | // array-type flags. Returns "" for single-value or object flags. |
| 168 | SchemaItemsTypescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/SchemaItemsTyper#SchemaItemsType.() string |
| 169 | } |
| 170 | |
| 171 | // Countable is an interface to enable detection of flag values which support |
| 172 | // repetitive flags |
| 173 | type Countablescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Countable# interface { |
| 174 | Countscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Countable#Count.() int |
| 175 | } |
| 176 | |
| 177 | // VisibleFlag is an interface that allows to check if a flag is visible |
| 178 | type VisibleFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/VisibleFlag# interface { |
| 179 | // IsVisible returns true if the flag is not hidden, otherwise false |
| 180 | IsVisiblescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/VisibleFlag#IsVisible.() bool |
| 181 | } |
| 182 | |
| 183 | // CategorizableFlag is an interface that allows us to potentially |
| 184 | // use a flag in a categorized representation. |
| 185 | type CategorizableFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/CategorizableFlag# interface { |
| 186 | // Returns the category of the flag |
| 187 | GetCategoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/CategorizableFlag#GetCategory.() string |
| 188 | |
| 189 | // Sets the category of the flag |
| 190 | SetCategoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/CategorizableFlag#SetCategory.(string) |
| 191 | } |
| 192 | |
| 193 | // LocalFlag is an interface to enable detection of flags which are local |
| 194 | // to current command |
| 195 | type LocalFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/LocalFlag# interface { |
| 196 | IsLocalscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/LocalFlag#IsLocal.() bool |
| 197 | } |
| 198 | |
| 199 | func visibleFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/visibleFlags().(fl []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#) []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag# { |
| 200 | var visible []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag# |
| 201 | for _, f := range fl { |
| 202 | if vf, ok := f.(VisibleFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/VisibleFlag#); ok && vf.IsVisiblescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/VisibleFlag#IsVisible.() { |
| 203 | visible = append(visible, f) |
| 204 | } |
| 205 | } |
| 206 | return visible |
| 207 | } |
| 208 | |
| 209 | func FlagNamesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagNames().(name string, aliases []string) []string { |
| 210 | var ret []string |
| 211 | |
| 212 | for _, part := range append([]string{name}, aliases...) { |
| 213 | // v1 -> v2 migration warning zone: |
| 214 | // Strip off anything after the first found comma or space, which |
| 215 | // *hopefully* makes it a tiny bit more obvious that unexpected behavior is |
| 216 | // caused by using the v1 form of stringly typed "Name". |
| 217 | if i := stringsscip-go gomod github.com/golang/go/src go1.22 strings/.IndexAnyscip-go gomod github.com/golang/go/src go1.22 strings/IndexAny().(part, ", "); i >= 0 { |
| 218 | ret = append(ret, part[:i]) |
| 219 | } else { |
| 220 | ret = append(ret, part) |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | return ret |
| 225 | } |
| 226 | |
| 227 | func hasFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/hasFlag().(flags []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#, fl Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#) bool { |
| 228 | return slicesscip-go gomod github.com/golang/go/src go1.22 slices/.Containsscip-go gomod github.com/golang/go/src go1.22 slices/Contains().(flags, fl) |
| 229 | } |
| 230 | |
| 231 | func flagSplitMultiValuesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/flagSplitMultiValues().(val string, sliceSeparator string, disableSliceSeparator bool) []string { |
| 232 | if disableSliceSeparator { |
| 233 | return []string{val} |
| 234 | } |
| 235 | |
| 236 | if len(sliceSeparator) == 0 { |
| 237 | sliceSeparator = defaultSliceFlagSeparatorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/defaultSliceFlagSeparator. |
| 238 | } |
| 239 | return stringsscip-go gomod github.com/golang/go/src go1.22 strings/.Splitscip-go gomod github.com/golang/go/src go1.22 strings/Split().(val, sliceSeparator) |
| 240 | } |