| 1 | package cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ |
| 2 | |
| 3 | import ( |
| 4 | "flagscip-go gomod github.com/golang/go/src go1.22 flag/" |
| 5 | "osscip-go gomod github.com/golang/go/src go1.22 os/" |
| 6 | "path/filepathscip-go gomod github.com/golang/go/src go1.22 `path/filepath`/" |
| 7 | "sortscip-go gomod github.com/golang/go/src go1.22 sort/" |
| 8 | "stringsscip-go gomod github.com/golang/go/src go1.22 strings/" |
| 9 | ) |
| 10 | |
| 11 | func (cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) setupDefaultsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#setupDefaults().(osArgs []string) { |
| 12 | if cmd.didSetupDefaultsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#didSetupDefaults. { |
| 13 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("already did setup (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 14 | return |
| 15 | } |
| 16 | |
| 17 | cmd.didSetupDefaultsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#didSetupDefaults. = true |
| 18 | |
| 19 | isRoot := cmd.parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent. == nil |
| 20 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("isRoot? %[1]v (cmd=%[2]q)", isRoot, cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 21 | |
| 22 | if cmd.ShellCompletescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ShellComplete. == nil { |
| 23 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting default ShellComplete (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 24 | cmd.ShellCompletescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ShellComplete. = DefaultCompleteWithFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DefaultCompleteWithFlags(). |
| 25 | } |
| 26 | |
| 27 | if cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name. == "" && isRoot { |
| 28 | name := filepathscip-go gomod github.com/golang/go/src go1.22 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.22 `path/filepath`/Base().(osArgs[0]) |
| 29 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting cmd.Name from first arg basename (cmd=%[1]q)", name) |
| 30 | cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name. = name |
| 31 | } |
| 32 | |
| 33 | if cmd.Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage. == "" && isRoot { |
| 34 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting default Usage (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 35 | cmd.Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage. = "A new cli application" |
| 36 | } |
| 37 | |
| 38 | if cmd.Versionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Version. == "" { |
| 39 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting HideVersion=true due to empty Version (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 40 | cmd.HideVersionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideVersion. = true |
| 41 | } |
| 42 | |
| 43 | if cmd.Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action. == nil { |
| 44 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting default Action as help command action (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 45 | cmd.Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action. = helpCommandActionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/helpCommandAction(). |
| 46 | } |
| 47 | |
| 48 | if cmd.Readerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Reader. == nil { |
| 49 | if cmd.parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent. != nil && cmd.parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent..Readerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Reader. != nil { |
| 50 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("inheriting Reader from parent (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 51 | cmd.Readerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Reader. = cmd.parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent..Readerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Reader. |
| 52 | } else { |
| 53 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting default Reader as os.Stdin (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 54 | cmd.Readerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Reader. = osscip-go gomod github.com/golang/go/src go1.22 os/.Stdinscip-go gomod github.com/golang/go/src go1.22 os/Stdin. |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | if cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. == nil { |
| 59 | if cmd.parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent. != nil && cmd.parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent..Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. != nil { |
| 60 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("inheriting Writer from parent (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 61 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = cmd.parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent..Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. |
| 62 | } else { |
| 63 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting default Writer as os.Stdout (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 64 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = osscip-go gomod github.com/golang/go/src go1.22 os/.Stdoutscip-go gomod github.com/golang/go/src go1.22 os/Stdout. |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | if cmd.ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ErrWriter. == nil { |
| 69 | if cmd.parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent. != nil && cmd.parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent..ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ErrWriter. != nil { |
| 70 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("inheriting ErrWriter from parent (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 71 | cmd.ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ErrWriter. = cmd.parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent..ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ErrWriter. |
| 72 | } else { |
| 73 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting default ErrWriter as os.Stderr (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 74 | cmd.ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ErrWriter. = osscip-go gomod github.com/golang/go/src go1.22 os/.Stderrscip-go gomod github.com/golang/go/src go1.22 os/Stderr. |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | if cmd.AllowExtFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#AllowExtFlags. { |
| 79 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("visiting all flags given AllowExtFlags=true (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 80 | // add global flags added by other packages |
| 81 | flagscip-go gomod github.com/golang/go/src go1.22 flag/.VisitAllscip-go gomod github.com/golang/go/src go1.22 flag/VisitAll().(func(f *flagscip-go gomod github.com/golang/go/src go1.22 flag/.Flagscip-go gomod github.com/golang/go/src go1.22 flag/Flag#) { |
| 82 | // skip test flags |
| 83 | if !stringsscip-go gomod github.com/golang/go/src go1.22 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.22 strings/HasPrefix().(f.Namescip-go gomod github.com/golang/go/src go1.22 flag/Flag#Name., ignoreFlagPrefixscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ignoreFlagPrefix.) { |
| 84 | cmd.Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags. = append(cmd.Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags., &extFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/extFlag#{f}) |
| 85 | } |
| 86 | }) |
| 87 | } |
| 88 | |
| 89 | for _, subCmd := range cmd.Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands. { |
| 90 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting sub-command (cmd=%[1]q) parent as self (cmd=%[2]q)", subCmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name., cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 91 | subCmd.parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent. = cmd |
| 92 | } |
| 93 | |
| 94 | cmd.ensureHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ensureHelp().() |
| 95 | |
| 96 | if !cmd.HideVersionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideVersion. && isRoot { |
| 97 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("appending version flag (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 98 | if !cmd.globaVersionFlagAddedscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#globaVersionFlagAdded. { |
| 99 | var localVersionFlag Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag# |
| 100 | if globalVersionFlag, ok := VersionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/VersionFlag..(*BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#); ok { |
| 101 | flag := *globalVersionFlag |
| 102 | // Drop any alias a user flag already claims (e.g. -v |
| 103 | // for --verbose) so the user flag wins but --version |
| 104 | // still works. See #2229. |
| 105 | flag.Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases. = dropClashingAliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/dropClashingAliases().(flag.Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases., cmd.allFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#allFlags().(), flag.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.) |
| 106 | localVersionFlag = &flag |
| 107 | } else { |
| 108 | localVersionFlag = VersionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/VersionFlag. |
| 109 | } |
| 110 | |
| 111 | if !flagNamesInUsescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/flagNamesInUse().(cmd.allFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#allFlags().(), localVersionFlag.Namesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#Names.()) { |
| 112 | cmd.appendFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#appendFlag().(localVersionFlag) |
| 113 | cmd.versionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#versionFlag. = localVersionFlag |
| 114 | cmd.globaVersionFlagAddedscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#globaVersionFlagAdded. = true |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | if cmd.PrefixMatchCommandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#PrefixMatchCommands. && cmd.SuggestCommandFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#SuggestCommandFunc. == nil { |
| 120 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting default SuggestCommandFunc (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 121 | cmd.SuggestCommandFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#SuggestCommandFunc. = suggestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/suggestCommand(). |
| 122 | } |
| 123 | |
| 124 | if isRoot && cmd.EnableShellCompletionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#EnableShellCompletion. || cmd.ConfigureShellCompletionCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ConfigureShellCompletionCommand. != nil { |
| 125 | completionCommand := buildCompletionCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildCompletionCommand().(cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 126 | |
| 127 | if cmd.ShellCompletionCommandNamescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ShellCompletionCommandName. != "" { |
| 128 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().( |
| 129 | "setting completion command name (%[1]q) from "+ |
| 130 | "cmd.ShellCompletionCommandName (cmd=%[2]q)", |
| 131 | cmd.ShellCompletionCommandNamescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ShellCompletionCommandName., cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name., |
| 132 | ) |
| 133 | completionCommand.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name. = cmd.ShellCompletionCommandNamescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ShellCompletionCommandName. |
| 134 | } |
| 135 | |
| 136 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("appending completionCommand (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 137 | cmd.appendCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#appendCommand().(completionCommand) |
| 138 | if cmd.ConfigureShellCompletionCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ConfigureShellCompletionCommand. != nil { |
| 139 | cmd.ConfigureShellCompletionCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ConfigureShellCompletionCommand.(completionCommand) |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting command categories (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 144 | cmd.categoriesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#categories. = newCommandCategoriesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/newCommandCategories().() |
| 145 | |
| 146 | for _, subCmd := range cmd.Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands. { |
| 147 | cmd.categoriesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#categories..AddCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/CommandCategories#AddCommand.(subCmd.Categoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Category., subCmd) |
| 148 | } |
| 149 | |
| 150 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("sorting command categories (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 151 | sortscip-go gomod github.com/golang/go/src go1.22 sort/.Sortscip-go gomod github.com/golang/go/src go1.22 sort/Sort().(cmd.categoriesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#categories..(*commandCategoriesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/commandCategories#)) |
| 152 | |
| 153 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting category on mutually exclusive flags (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 154 | for _, grp := range cmd.MutuallyExclusiveFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#MutuallyExclusiveFlags. { |
| 155 | grp.propagateCategoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/MutuallyExclusiveFlags#propagateCategory().() |
| 156 | } |
| 157 | |
| 158 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting flag categories (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 159 | cmd.flagCategoriesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#flagCategories. = newFlagCategoriesFromFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/newFlagCategoriesFromFlags().(cmd.allFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#allFlags().()) |
| 160 | |
| 161 | if cmd.Metadatascip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Metadata. == nil { |
| 162 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting default Metadata (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 163 | cmd.Metadatascip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Metadata. = map[string]any{} |
| 164 | } |
| 165 | |
| 166 | cmd.setFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#setFlags. = map[Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#]struct{}{} |
| 167 | } |
| 168 | |
| 169 | func (cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) setupCommandGraphscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#setupCommandGraph().() { |
| 170 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting up command graph (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 171 | |
| 172 | _ = cmd.Walkscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Walk().(func(sub *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 173 | for _, subCmd := range sub.Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands. { |
| 174 | subCmd.parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent. = sub |
| 175 | subCmd.setupSubcommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#setupSubcommand().() |
| 176 | } |
| 177 | return nil |
| 178 | }) |
| 179 | } |
| 180 | |
| 181 | func (cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) setupSubcommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#setupSubcommand().() { |
| 182 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting up self as sub-command (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 183 | |
| 184 | cmd.ensureHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ensureHelp().() |
| 185 | |
| 186 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting command categories (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 187 | cmd.categoriesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#categories. = newCommandCategoriesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/newCommandCategories().() |
| 188 | |
| 189 | for _, subCmd := range cmd.Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands. { |
| 190 | cmd.categoriesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#categories..AddCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/CommandCategories#AddCommand.(subCmd.Categoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Category., subCmd) |
| 191 | } |
| 192 | |
| 193 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("sorting command categories (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 194 | sortscip-go gomod github.com/golang/go/src go1.22 sort/.Sortscip-go gomod github.com/golang/go/src go1.22 sort/Sort().(cmd.categoriesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#categories..(*commandCategoriesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/commandCategories#)) |
| 195 | |
| 196 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting category on mutually exclusive flags (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 197 | for _, grp := range cmd.MutuallyExclusiveFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#MutuallyExclusiveFlags. { |
| 198 | grp.propagateCategoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/MutuallyExclusiveFlags#propagateCategory().() |
| 199 | } |
| 200 | |
| 201 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("setting flag categories (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 202 | cmd.flagCategoriesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#flagCategories. = newFlagCategoriesFromFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/newFlagCategoriesFromFlags().(cmd.allFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#allFlags().()) |
| 203 | } |
| 204 | |
| 205 | func flagNamesInUsescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/flagNamesInUse().(flags []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#, names []string) bool { |
| 206 | for _, name := range names { |
| 207 | for _, fl := range flags { |
| 208 | for _, flagName := range fl.Namesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#Names.() { |
| 209 | if flagName == name { |
| 210 | return true |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | return false |
| 217 | } |
| 218 | |
| 219 | func (cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) hideHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#hideHelp().() bool { |
| 220 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("hide help (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 221 | for c := cmd; c != nil; c = c.parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent. { |
| 222 | if c.HideHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelp. { |
| 223 | return true |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | return false |
| 228 | } |
| 229 | |
| 230 | func (cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) ensureHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ensureHelp().() { |
| 231 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("ensuring help (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 232 | |
| 233 | helpCommand := buildHelpCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildHelpCommand().(true) |
| 234 | |
| 235 | if !cmd.hideHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#hideHelp().() { |
| 236 | if cmd.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Command().(helpCommand.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) == nil { |
| 237 | if !cmd.HideHelpCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelpCommand. { |
| 238 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("appending helpCommand (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 239 | cmd.appendCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#appendCommand().(helpCommand) |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | if HelpFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpFlag. != nil { |
| 244 | if !cmd.globaHelpFlagAddedscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#globaHelpFlagAdded. { |
| 245 | var localHelpFlag Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag# |
| 246 | if globalHelpFlag, ok := HelpFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpFlag..(*BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#); ok { |
| 247 | flag := *globalHelpFlag |
| 248 | localHelpFlag = &flag |
| 249 | } else { |
| 250 | localHelpFlag = HelpFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpFlag. |
| 251 | } |
| 252 | |
| 253 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("appending HelpFlag (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 254 | cmd.appendFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#appendFlag().(localHelpFlag) |
| 255 | cmd.globaHelpFlagAddedscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#globaHelpFlagAdded. = true |
| 256 | } else { |
| 257 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("HelpFlag already added, skip (cmd=%[1]q)", cmd.Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.) |
| 258 | } |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | // dropClashingAliases removes aliases from `aliases` that are already |
| 264 | // claimed by a flag in `userFlags` (either as a primary name or as one |
| 265 | // of its own aliases). Aliases equal to `selfName` are kept so the |
| 266 | // flag's primary name doesn't accidentally remove itself. |
| 267 | func dropClashingAliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/dropClashingAliases().(aliases []string, userFlags []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#, selfName string) []string { |
| 268 | if len(aliases) == 0 || len(userFlags) == 0 { |
| 269 | return aliases |
| 270 | } |
| 271 | taken := map[string]struct{}{} |
| 272 | for _, f := range userFlags { |
| 273 | for _, n := range f.Namesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#Names.() { |
| 274 | taken[n] = struct{}{} |
| 275 | } |
| 276 | } |
| 277 | kept := aliases[:0:0] |
| 278 | for _, a := range aliases { |
| 279 | if a == selfName { |
| 280 | kept = append(kept, a) |
| 281 | continue |
| 282 | } |
| 283 | if _, ok := taken[a]; ok { |
| 284 | continue |
| 285 | } |
| 286 | kept = append(kept, a) |
| 287 | } |
| 288 | return kept |
| 289 | } |