| 1 | package cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.22 bytes/" |
| 5 | "contextscip-go gomod github.com/golang/go/src go1.22 context/" |
| 6 | "errorsscip-go gomod github.com/golang/go/src go1.22 errors/" |
| 7 | "fmtscip-go gomod github.com/golang/go/src go1.22 fmt/" |
| 8 | "ioscip-go gomod github.com/golang/go/src go1.22 io/" |
| 9 | "osscip-go gomod github.com/golang/go/src go1.22 os/" |
| 10 | "runtimescip-go gomod github.com/golang/go/src go1.22 runtime/" |
| 11 | "stringsscip-go gomod github.com/golang/go/src go1.22 strings/" |
| 12 | "testingscip-go gomod github.com/golang/go/src go1.22 testing/" |
| 13 | |
| 14 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/" |
| 15 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/" |
| 16 | ) |
| 17 | |
| 18 | func Test_ShowRootCommandHelp_NoAuthorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_ShowRootCommandHelp_NoAuthor().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 19 | output := new(bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#) |
| 20 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output} |
| 21 | _ = ShowRootCommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ShowRootCommandHelp.(cmd) |
| 22 | |
| 23 | if bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Containsscip-go gomod github.com/golang/go/src go1.22 bytes/Contains().(output.Bytesscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#Bytes().(), []byte("AUTHOR(S):")) { |
| 24 | t.Errorfscip-go gomod github.com/golang/go/src go1.22 testing/common#Errorf().("expected\n%snot to include %s", output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "AUTHOR(S):") |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | func Test_ShowRootCommandHelp_NoVersionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_ShowRootCommandHelp_NoVersion().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 29 | output := new(bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#) |
| 30 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output} |
| 31 | |
| 32 | cmd.Versionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Version. = "" |
| 33 | |
| 34 | _ = ShowRootCommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ShowRootCommandHelp.(cmd) |
| 35 | |
| 36 | if bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Containsscip-go gomod github.com/golang/go/src go1.22 bytes/Contains().(output.Bytesscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#Bytes().(), []byte("VERSION:")) { |
| 37 | t.Errorfscip-go gomod github.com/golang/go/src go1.22 testing/common#Errorf().("expected\n%snot to include %s", output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "VERSION:") |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | func Test_ShowRootCommandHelp_HideVersionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_ShowRootCommandHelp_HideVersion().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 42 | output := new(bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#) |
| 43 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output} |
| 44 | |
| 45 | cmd.HideVersionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideVersion. = true |
| 46 | |
| 47 | _ = ShowRootCommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ShowRootCommandHelp.(cmd) |
| 48 | |
| 49 | if bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Containsscip-go gomod github.com/golang/go/src go1.22 bytes/Contains().(output.Bytesscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#Bytes().(), []byte("VERSION:")) { |
| 50 | t.Errorfscip-go gomod github.com/golang/go/src go1.22 testing/common#Errorf().("expected\n%snot to include %s", output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "VERSION:") |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | func Test_ShowRootCommandHelp_MultiLineDescriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_ShowRootCommandHelp_MultiLineDescription().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 55 | output := new(bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#) |
| 56 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output} |
| 57 | |
| 58 | cmd.HideVersionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideVersion. = true |
| 59 | cmd.Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description. = "multi\n line" |
| 60 | |
| 61 | _ = ShowRootCommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ShowRootCommandHelp.(cmd) |
| 62 | |
| 63 | if !bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Containsscip-go gomod github.com/golang/go/src go1.22 bytes/Contains().(output.Bytesscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#Bytes().(), []byte("DESCRIPTION:\n multi\n line")) { |
| 64 | t.Errorfscip-go gomod github.com/golang/go/src go1.22 testing/common#Errorf().("expected\n%s\nto include\n%s", output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "DESCRIPTION:\n multi\n line") |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | func TestShowCommandHelpAndExitscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowCommandHelpAndExit().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 69 | output := new(bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#) |
| 70 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 71 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 72 | { |
| 73 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "ok", |
| 74 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output, |
| 75 | }, |
| 76 | }, |
| 77 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output, |
| 78 | } |
| 79 | |
| 80 | ShowCommandHelpAndExitscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ShowCommandHelpAndExit().(contextscip-go gomod github.com/golang/go/src go1.22 context/.Backgroundscip-go gomod github.com/golang/go/src go1.22 context/Background().(), cmd, "ok", 42) |
| 81 | |
| 82 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Equal().(t, 42, lastExitCodescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/lastExitCode.) |
| 83 | } |
| 84 | |
| 85 | func TestShowRootCommandHelpAndExitscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowRootCommandHelpAndExit().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 86 | output := new(bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#) |
| 87 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output} |
| 88 | |
| 89 | ShowRootCommandHelpAndExitscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ShowRootCommandHelpAndExit().(cmd, 42) |
| 90 | |
| 91 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Equal().(t, 42, lastExitCodescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/lastExitCode.) |
| 92 | } |
| 93 | |
| 94 | func TestShowSubcommandHelpAndExitscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowSubcommandHelpAndExit().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 95 | output := new(bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#) |
| 96 | ok := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 97 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "ok", |
| 98 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output, |
| 99 | } |
| 100 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 101 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ok}, |
| 102 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output, |
| 103 | } |
| 104 | _ = cmd |
| 105 | |
| 106 | ShowSubcommandHelpAndExitscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ShowSubcommandHelpAndExit().(ok, 42) |
| 107 | |
| 108 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Equal().(t, 42, lastExitCodescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/lastExitCode.) |
| 109 | } |
| 110 | |
| 111 | func Test_HelpFlag_RequiredFlagsNoDefaultscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_HelpFlag_RequiredFlagsNoDefault().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 112 | output := new(bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#) |
| 113 | |
| 114 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 115 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 116 | &Int64Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64Flag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "foo", Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"f"}, Requiredscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Required.: true}, |
| 117 | }, |
| 118 | Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments.: AnyArgumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/AnyArguments., |
| 119 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output, |
| 120 | } |
| 121 | |
| 122 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"test", "-h"}) |
| 123 | |
| 124 | expected := `NAME: |
| 125 | test - A new cli application |
| 126 | |
| 127 | USAGE: |
| 128 | test [global options] [arguments...] |
| 129 | |
| 130 | GLOBAL OPTIONS: |
| 131 | --foo int, -f int |
| 132 | --help, -h show help |
| 133 | ` |
| 134 | |
| 135 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), expected, |
| 136 | "expected output to include usage text") |
| 137 | } |
| 138 | |
| 139 | func Test_HelpCommand_RequiredFlagsNoDefaultscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_HelpCommand_RequiredFlagsNoDefault().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 140 | output := new(bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#) |
| 141 | |
| 142 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 143 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 144 | &Int64Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64Flag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "foo", Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"f"}, Requiredscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Required.: true}, |
| 145 | }, |
| 146 | Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments.: AnyArgumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/AnyArguments., |
| 147 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output, |
| 148 | } |
| 149 | |
| 150 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"test", "help"}) |
| 151 | |
| 152 | expected := `NAME: |
| 153 | test - A new cli application |
| 154 | |
| 155 | USAGE: |
| 156 | test [global options] [arguments...] |
| 157 | |
| 158 | GLOBAL OPTIONS: |
| 159 | --foo int, -f int |
| 160 | --help, -h show help |
| 161 | ` |
| 162 | |
| 163 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), expected, |
| 164 | "expected output to include usage text") |
| 165 | } |
| 166 | |
| 167 | // Test_HelpCommand_ParsesFlags is a regression test for #2271: flags |
| 168 | // declared on a user-supplied command named "help" must still be parsed. |
| 169 | // Previously in v3.6.2 flag pre-parsing was skipped for any command named |
| 170 | // "help", causing such flags to be silently dropped. |
| 171 | func Test_HelpCommand_ParsesFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_HelpCommand_ParsesFlags().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 172 | var parsed string |
| 173 | |
| 174 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 175 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "app", |
| 176 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 177 | { |
| 178 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "help", |
| 179 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 180 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "topic", Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"t"}}, |
| 181 | }, |
| 182 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(_ contextscip-go gomod github.com/golang/go/src go1.22 context/.Contextscip-go gomod github.com/golang/go/src go1.22 context/Context#, c *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 183 | parsed = c.Stringscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#String().("topic") |
| 184 | return nil |
| 185 | }, |
| 186 | }, |
| 187 | }, |
| 188 | } |
| 189 | |
| 190 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"app", "help", "--topic", "foo"}) |
| 191 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 192 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "foo", parsed, |
| 193 | "expected --topic flag on help subcommand to be parsed") |
| 194 | } |
| 195 | |
| 196 | func Test_Help_Custom_Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_Help_Custom_Flags().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 197 | oldFlag := HelpFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpFlag. |
| 198 | defer func() { |
| 199 | HelpFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpFlag. = oldFlag |
| 200 | }() |
| 201 | |
| 202 | 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#{ |
| 203 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "help", |
| 204 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"x"}, |
| 205 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Usage.: "show help", |
| 206 | } |
| 207 | |
| 208 | out := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 209 | |
| 210 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 211 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 212 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "foo", Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"h"}}, |
| 213 | }, |
| 214 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(_ contextscip-go gomod github.com/golang/go/src go1.22 context/.Contextscip-go gomod github.com/golang/go/src go1.22 context/Context#, cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 215 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, cmd.Boolscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Bool().("h"), "custom help flag not set") |
| 216 | return nil |
| 217 | }, |
| 218 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: out, |
| 219 | } |
| 220 | |
| 221 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"test", "-h"}) |
| 222 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Lenscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Len().(t, out.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), 0) |
| 223 | } |
| 224 | |
| 225 | func Test_Help_Nil_Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_Help_Nil_Flags().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 226 | oldFlag := HelpFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpFlag. |
| 227 | defer func() { |
| 228 | HelpFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpFlag. = oldFlag |
| 229 | }() |
| 230 | HelpFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpFlag. = nil |
| 231 | |
| 232 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 233 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(_ contextscip-go gomod github.com/golang/go/src go1.22 context/.Contextscip-go gomod github.com/golang/go/src go1.22 context/Context#, cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 234 | return nil |
| 235 | }, |
| 236 | } |
| 237 | out := new(bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#) |
| 238 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = out |
| 239 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"test"}) |
| 240 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Lenscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Len().(t, out.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), 0) |
| 241 | } |
| 242 | |
| 243 | func Test_Version_Custom_Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_Version_Custom_Flags().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 244 | oldFlag := VersionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/VersionFlag. |
| 245 | defer func() { |
| 246 | VersionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/VersionFlag. = oldFlag |
| 247 | }() |
| 248 | |
| 249 | 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#{ |
| 250 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "version", |
| 251 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"V"}, |
| 252 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Usage.: "show version", |
| 253 | } |
| 254 | |
| 255 | out := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 256 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 257 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 258 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "foo", Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"v"}}, |
| 259 | }, |
| 260 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(_ contextscip-go gomod github.com/golang/go/src go1.22 context/.Contextscip-go gomod github.com/golang/go/src go1.22 context/Context#, cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 261 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, cmd.Boolscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Bool().("v"), "custom version flag not set") |
| 262 | return nil |
| 263 | }, |
| 264 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: out, |
| 265 | } |
| 266 | |
| 267 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"test", "-v"}) |
| 268 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Lenscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Len().(t, out.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), 0) |
| 269 | } |
| 270 | |
| 271 | func Test_helpCommand_Action_ErrorIfNoTopicscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_helpCommand_Action_ErrorIfNoTopic().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 272 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{} |
| 273 | |
| 274 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(contextscip-go gomod github.com/golang/go/src go1.22 context/.Backgroundscip-go gomod github.com/golang/go/src go1.22 context/Background().(), []string{"foo", "bar"}) |
| 275 | |
| 276 | err := helpCommandActionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/helpCommandAction().(contextscip-go gomod github.com/golang/go/src go1.22 context/.Backgroundscip-go gomod github.com/golang/go/src go1.22 context/Background().(), cmd) |
| 277 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Error().(t, err, "expected error from helpCommandAction()") |
| 278 | |
| 279 | exitErr, ok := err.(*exitErrorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/exitError#) |
| 280 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/True().(t, ok, "expected *exitError from helpCommandAction()") |
| 281 | |
| 282 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Contains().(t, exitErr.Errorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/exitError#Error().(), "No help topic for", "expected an unknown help topic error") |
| 283 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Equal().(t, 3, exitErr.exitCodescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/exitError#exitCode., "expected exit value = 3") |
| 284 | } |
| 285 | |
| 286 | func Test_helpCommand_InHelpOutputscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_helpCommand_InHelpOutput().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 287 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{} |
| 288 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 289 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = output |
| 290 | |
| 291 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"test", "--help"}) |
| 292 | |
| 293 | s := output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().() |
| 294 | |
| 295 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotContains().(t, s, "\nCOMMANDS:\nGLOBAL OPTIONS:\n", "empty COMMANDS section detected") |
| 296 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Contains().(t, s, "--help, -h", "missing \"--help, --h\"") |
| 297 | } |
| 298 | |
| 299 | func TestHelpCommand_FullNamescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestHelpCommand_FullName().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 300 | testCases := []struct { |
| 301 | name string |
| 302 | args []string |
| 303 | contains string |
| 304 | skip bool |
| 305 | }{ |
| 306 | { |
| 307 | name: "app help's FullName", |
| 308 | args: []string{"app", "help", "help"}, |
| 309 | contains: "app help -", |
| 310 | }, |
| 311 | { |
| 312 | name: "app help's FullName via flag", |
| 313 | args: []string{"app", "-h", "help"}, |
| 314 | contains: "app help -", |
| 315 | }, |
| 316 | { |
| 317 | name: "cmd help's FullName", |
| 318 | args: []string{"app", "cmd", "help", "help"}, |
| 319 | contains: "app cmd help -", |
| 320 | skip: true, // FIXME: App Command collapse |
| 321 | }, |
| 322 | { |
| 323 | name: "cmd help's FullName via flag", |
| 324 | args: []string{"app", "cmd", "-h", "help"}, |
| 325 | contains: "app cmd help -", |
| 326 | skip: true, // FIXME: App Command collapse |
| 327 | }, |
| 328 | { |
| 329 | name: "subcmd help's FullName", |
| 330 | args: []string{"app", "cmd", "subcmd", "help", "help"}, |
| 331 | contains: "app cmd subcmd help -", |
| 332 | }, |
| 333 | { |
| 334 | name: "subcmd help's FullName via flag", |
| 335 | args: []string{"app", "cmd", "subcmd", "-h", "help"}, |
| 336 | contains: "app cmd subcmd help -", |
| 337 | }, |
| 338 | } |
| 339 | for _, tc := range testCases { |
| 340 | t.Runscip-go gomod github.com/golang/go/src go1.22 testing/T#Run().(tc.name, func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 341 | out := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 342 | |
| 343 | if tc.skip { |
| 344 | t.SkipNowscip-go gomod github.com/golang/go/src go1.22 testing/common#SkipNow().() |
| 345 | } |
| 346 | |
| 347 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 348 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "app", |
| 349 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 350 | { |
| 351 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "cmd", |
| 352 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 353 | { |
| 354 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "subcmd", |
| 355 | }, |
| 356 | }, |
| 357 | }, |
| 358 | }, |
| 359 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: out, |
| 360 | ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ErrWriter.: out, |
| 361 | } |
| 362 | |
| 363 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 364 | r.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NoError().(cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), tc.args)) |
| 365 | r.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Contains().(out.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), tc.contains) |
| 366 | }) |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | func Test_helpCommand_HideHelpCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_helpCommand_HideHelpCommand().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 371 | buf := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 372 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 373 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "app", |
| 374 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: buf, |
| 375 | } |
| 376 | |
| 377 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"app", "help", "help"}) |
| 378 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 379 | got := buf.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().() |
| 380 | notWant := "COMMANDS:" |
| 381 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotContains().(t, got, notWant) |
| 382 | } |
| 383 | |
| 384 | func Test_helpCommand_HideHelpFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_helpCommand_HideHelpFlag().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 385 | cmd := buildMinimalTestCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildMinimalTestCommand().() |
| 386 | cmd.HideHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelp. = true |
| 387 | |
| 388 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Error().(t, cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"app", "help", "-h"}), "Expected flag error - Got nil") |
| 389 | } |
| 390 | |
| 391 | func Test_helpSubcommand_Action_ErrorIfNoTopicscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_helpSubcommand_Action_ErrorIfNoTopic().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 392 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{} |
| 393 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(contextscip-go gomod github.com/golang/go/src go1.22 context/.Backgroundscip-go gomod github.com/golang/go/src go1.22 context/Background().(), []string{"foo", "bar"}) |
| 394 | |
| 395 | err := helpCommandActionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/helpCommandAction().(contextscip-go gomod github.com/golang/go/src go1.22 context/.Backgroundscip-go gomod github.com/golang/go/src go1.22 context/Background().(), cmd) |
| 396 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Error().(t, err, "expected error from helpCommandAction(), but got nil") |
| 397 | |
| 398 | exitErr, ok := err.(*exitErrorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/exitError#) |
| 399 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/True().(t, ok, "expected *exitError from helpCommandAction(), but instead got: %v", err.Error()) |
| 400 | |
| 401 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Contains().(t, exitErr.Errorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/exitError#Error().(), "No help topic for", "expected an unknown help topic error") |
| 402 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Equal().(t, 3, exitErr.exitCodescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/exitError#exitCode., "unexpected exit value") |
| 403 | } |
| 404 | |
| 405 | func TestShowRootCommandHelp_CommandAliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowRootCommandHelp_CommandAliases().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 406 | out := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 407 | |
| 408 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 409 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 410 | { |
| 411 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 412 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"fr", "frob"}, |
| 413 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 414 | return nil |
| 415 | }, |
| 416 | }, |
| 417 | }, |
| 418 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: out, |
| 419 | } |
| 420 | |
| 421 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "--help"}) |
| 422 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Contains().(t, out.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "frobbly, fr, frob") |
| 423 | } |
| 424 | |
| 425 | func TestShowCommandHelp_AppendHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowCommandHelp_AppendHelp().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 426 | testCases := []struct { |
| 427 | name string |
| 428 | hideHelp bool |
| 429 | hideHelpCommand bool |
| 430 | args []string |
| 431 | verify func(*testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#, string) |
| 432 | }{ |
| 433 | { |
| 434 | name: "with HideHelp", |
| 435 | hideHelp: true, |
| 436 | args: []string{"app", "help"}, |
| 437 | verify: func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#, outString string) { |
| 438 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 439 | r.NotContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NotContains().(outString, "help, h Shows a list of commands or help for one command") |
| 440 | r.NotContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NotContains().(outString, "--help, -h show help") |
| 441 | }, |
| 442 | }, |
| 443 | { |
| 444 | name: "with HideHelpCommand", |
| 445 | hideHelpCommand: true, |
| 446 | args: []string{"app", "--help"}, |
| 447 | verify: func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#, outString string) { |
| 448 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 449 | r.NotContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NotContains().(outString, "help, h Shows a list of commands or help for one command") |
| 450 | r.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Contains().(outString, "--help, -h show help") |
| 451 | }, |
| 452 | }, |
| 453 | { |
| 454 | name: "with Subcommand", |
| 455 | args: []string{"app", "cmd", "help"}, |
| 456 | verify: func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#, outString string) { |
| 457 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 458 | r.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Contains().(outString, "--help, -h show help") |
| 459 | }, |
| 460 | }, |
| 461 | { |
| 462 | name: "without Subcommand", |
| 463 | args: []string{"app", "help"}, |
| 464 | verify: func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#, outString string) { |
| 465 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 466 | r.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Contains().(outString, "help, h Shows a list of commands or help for one command") |
| 467 | r.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Contains().(outString, "--help, -h show help") |
| 468 | }, |
| 469 | }, |
| 470 | } |
| 471 | for _, tc := range testCases { |
| 472 | out := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 473 | |
| 474 | t.Runscip-go gomod github.com/golang/go/src go1.22 testing/T#Run().(tc.name, func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 475 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 476 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "app", |
| 477 | HideHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelp.: tc.hideHelp, |
| 478 | HideHelpCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelpCommand.: tc.hideHelpCommand, |
| 479 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 480 | { |
| 481 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "cmd", |
| 482 | HideHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelp.: tc.hideHelp, |
| 483 | HideHelpCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelpCommand.: tc.hideHelpCommand, |
| 484 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "subcmd"}}, |
| 485 | }, |
| 486 | }, |
| 487 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: out, |
| 488 | ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ErrWriter.: out, |
| 489 | } |
| 490 | |
| 491 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), tc.args) |
| 492 | tc.verify(t, out.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().()) |
| 493 | }) |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | func TestShowCommandHelp_HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowCommandHelp_HelpPrinter().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 498 | /*doublecho := func(text string) string { |
| 499 | return text + " " + text |
| 500 | }*/ |
| 501 | |
| 502 | tests := []struct { |
| 503 | name string |
| 504 | template string |
| 505 | printer HelpPrinterFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterFunc# |
| 506 | command string |
| 507 | wantTemplate string |
| 508 | wantOutput string |
| 509 | }{ |
| 510 | { |
| 511 | name: "no-command", |
| 512 | template: "", |
| 513 | printer: func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, _ string, _ any) { |
| 514 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Fprintscip-go gomod github.com/golang/go/src go1.22 fmt/Fprint().(w, "yo") |
| 515 | }, |
| 516 | command: "", |
| 517 | wantTemplate: RootCommandHelpTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/RootCommandHelpTemplate., |
| 518 | wantOutput: "yo", |
| 519 | }, |
| 520 | /*{ |
| 521 | name: "standard-command", |
| 522 | template: "", |
| 523 | printer: func(w io.Writer, templ string, data interface{}) { |
| 524 | fmt.Fprint(w, "yo") |
| 525 | }, |
| 526 | command: "my-command", |
| 527 | wantTemplate: CommandHelpTemplate, |
| 528 | wantOutput: "yo", |
| 529 | }, |
| 530 | { |
| 531 | name: "custom-template-command", |
| 532 | template: "{{doublecho .Name}}", |
| 533 | printer: func(w io.Writer, templ string, data interface{}) { |
| 534 | // Pass a custom function to ensure it gets used |
| 535 | fm := map[string]interface{}{"doublecho": doublecho} |
| 536 | HelpPrinterCustom(w, templ, data, fm) |
| 537 | }, |
| 538 | command: "my-command", |
| 539 | wantTemplate: "{{doublecho .Name}}", |
| 540 | wantOutput: "my-command my-command", |
| 541 | },*/ |
| 542 | } |
| 543 | |
| 544 | for _, tt := range tests { |
| 545 | t.Runscip-go gomod github.com/golang/go/src go1.22 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 546 | defer func(old HelpPrinterFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterFunc#) { |
| 547 | HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter. = old |
| 548 | }(HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter.) |
| 549 | HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter. = func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, templ string, data any) { |
| 550 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, tt.wantTemplate, templ, "template mismatch") |
| 551 | tt.printer(w, templ, data) |
| 552 | } |
| 553 | |
| 554 | var buf bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer# |
| 555 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 556 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "my-app", |
| 557 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: &buf, |
| 558 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 559 | { |
| 560 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "my-command", |
| 561 | CustomHelpTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#CustomHelpTemplate.: tt.template, |
| 562 | }, |
| 563 | }, |
| 564 | } |
| 565 | |
| 566 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"my-app", "help", tt.command}) |
| 567 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 568 | |
| 569 | got := buf.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().() |
| 570 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, tt.wantOutput, got) |
| 571 | }) |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | func TestShowCommandHelp_HelpPrinterCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowCommandHelp_HelpPrinterCustom().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 576 | doublecho := func(text string) string { |
| 577 | return text + " " + text |
| 578 | } |
| 579 | |
| 580 | testCases := []struct { |
| 581 | name string |
| 582 | template string |
| 583 | printer HelpPrinterCustomFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustomFunc# |
| 584 | arguments []string |
| 585 | wantTemplate string |
| 586 | wantOutput string |
| 587 | }{ |
| 588 | { |
| 589 | name: "no command", |
| 590 | printer: func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, _ string, _ any, _ map[string]any) { |
| 591 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Fprintscip-go gomod github.com/golang/go/src go1.22 fmt/Fprint().(w, "yo") |
| 592 | }, |
| 593 | arguments: []string{"my-app", "help"}, |
| 594 | wantTemplate: RootCommandHelpTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/RootCommandHelpTemplate., |
| 595 | wantOutput: "yo", |
| 596 | }, |
| 597 | { |
| 598 | name: "standard command", |
| 599 | printer: func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, _ string, _ any, _ map[string]any) { |
| 600 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Fprintscip-go gomod github.com/golang/go/src go1.22 fmt/Fprint().(w, "yo") |
| 601 | }, |
| 602 | arguments: []string{"my-app", "help", "my-command"}, |
| 603 | wantTemplate: CommandHelpTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/CommandHelpTemplate., |
| 604 | wantOutput: "yo", |
| 605 | }, |
| 606 | { |
| 607 | name: "custom template command", |
| 608 | template: "{{doublecho .Name}}", |
| 609 | printer: func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, templ string, data any, _ map[string]any) { |
| 610 | // Pass a custom function to ensure it gets used |
| 611 | fm := map[string]any{"doublecho": doublecho} |
| 612 | DefaultPrintHelpCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DefaultPrintHelpCustom().(w, templ, data, fm) |
| 613 | }, |
| 614 | arguments: []string{"my-app", "help", "my-command"}, |
| 615 | wantTemplate: "{{doublecho .Name}}", |
| 616 | wantOutput: "my-command my-command", |
| 617 | }, |
| 618 | } |
| 619 | |
| 620 | for _, tc := range testCases { |
| 621 | t.Runscip-go gomod github.com/golang/go/src go1.22 testing/T#Run().(tc.name, func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 622 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 623 | |
| 624 | defer func(old HelpPrinterCustomFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustomFunc#) { |
| 625 | HelpPrinterCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustom. = old |
| 626 | }(HelpPrinterCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustom.) |
| 627 | |
| 628 | HelpPrinterCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustom. = func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, tmpl string, data any, fm map[string]any) { |
| 629 | r.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Nil().(fm) |
| 630 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(tc.wantTemplate, tmpl) |
| 631 | |
| 632 | tc.printer(w, tmpl, data, fm) |
| 633 | } |
| 634 | |
| 635 | out := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 636 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 637 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "my-app", |
| 638 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: out, |
| 639 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 640 | { |
| 641 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "my-command", |
| 642 | CustomHelpTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#CustomHelpTemplate.: tc.template, |
| 643 | }, |
| 644 | }, |
| 645 | } |
| 646 | |
| 647 | t.Logfscip-go gomod github.com/golang/go/src go1.22 testing/common#Logf().("cmd.Run(ctx, %+[1]v)", tc.arguments) |
| 648 | |
| 649 | r.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NoError().(cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), tc.arguments)) |
| 650 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(tc.wantOutput, out.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().()) |
| 651 | }) |
| 652 | } |
| 653 | } |
| 654 | |
| 655 | func TestShowCommandHelp_CommandAliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowCommandHelp_CommandAliases().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 656 | out := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 657 | |
| 658 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 659 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 660 | { |
| 661 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 662 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"fr", "frob", "bork"}, |
| 663 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 664 | return nil |
| 665 | }, |
| 666 | }, |
| 667 | }, |
| 668 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: out, |
| 669 | } |
| 670 | |
| 671 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "help", "fr"}) |
| 672 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Contains().(t, out.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "frobbly") |
| 673 | } |
| 674 | |
| 675 | func TestShowSubcommandHelp_CommandAliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowSubcommandHelp_CommandAliases().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 676 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 677 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 678 | { |
| 679 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 680 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"fr", "frob", "bork"}, |
| 681 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 682 | return nil |
| 683 | }, |
| 684 | }, |
| 685 | }, |
| 686 | } |
| 687 | |
| 688 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 689 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = output |
| 690 | |
| 691 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "help"}) |
| 692 | |
| 693 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "frobbly, fr, frob, bork", "expected output to include all command aliases") |
| 694 | } |
| 695 | |
| 696 | func TestShowCommandHelp_Customtemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowCommandHelp_Customtemplate().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 697 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 698 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "foo", |
| 699 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 700 | { |
| 701 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 702 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 703 | return nil |
| 704 | }, |
| 705 | CustomHelpTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#CustomHelpTemplate.: `NAME: |
| 706 | {{.FullName}} - {{.Usage}} |
| 707 | |
| 708 | USAGE: |
| 709 | {{.FullName}} [FLAGS] TARGET [TARGET ...] |
| 710 | |
| 711 | FLAGS: |
| 712 | {{range .VisibleFlags}}{{.}} |
| 713 | {{end}} |
| 714 | EXAMPLES: |
| 715 | 1. Frobbly runs with this param locally. |
| 716 | $ {{.FullName}} wobbly |
| 717 | `, |
| 718 | }, |
| 719 | }, |
| 720 | } |
| 721 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 722 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = output |
| 723 | |
| 724 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "help", "frobbly"}) |
| 725 | |
| 726 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotContains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "2. Frobbly runs without this param locally.", |
| 727 | "expected output to exclude \"2. Frobbly runs without this param locally.\";") |
| 728 | |
| 729 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "1. Frobbly runs with this param locally.", |
| 730 | "expected output to include \"1. Frobbly runs with this param locally.\"") |
| 731 | |
| 732 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "$ foo frobbly wobbly", |
| 733 | "expected output to include \"$ foo frobbly wobbly\"") |
| 734 | } |
| 735 | |
| 736 | func TestShowSubcommandHelp_CommandUsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowSubcommandHelp_CommandUsageText().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 737 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 738 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 739 | { |
| 740 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 741 | UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UsageText.: "this is usage text", |
| 742 | }, |
| 743 | }, |
| 744 | } |
| 745 | |
| 746 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 747 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = output |
| 748 | |
| 749 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "frobbly", "--help"}) |
| 750 | |
| 751 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "this is usage text", |
| 752 | "expected output to include usage text") |
| 753 | } |
| 754 | |
| 755 | func TestShowSubcommandHelp_MultiLine_CommandUsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowSubcommandHelp_MultiLine_CommandUsageText().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 756 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 757 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 758 | { |
| 759 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 760 | UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UsageText.: `This is a |
| 761 | multi |
| 762 | line |
| 763 | UsageText`, |
| 764 | }, |
| 765 | }, |
| 766 | } |
| 767 | |
| 768 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 769 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = output |
| 770 | |
| 771 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "frobbly", "--help"}) |
| 772 | |
| 773 | expected := `USAGE: |
| 774 | This is a |
| 775 | multi |
| 776 | line |
| 777 | UsageText |
| 778 | ` |
| 779 | |
| 780 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), expected, |
| 781 | "expected output to include usage text") |
| 782 | } |
| 783 | |
| 784 | func TestShowSubcommandHelp_GlobalOptionsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowSubcommandHelp_GlobalOptions().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 785 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 786 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 787 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 788 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "foo", |
| 789 | }, |
| 790 | }, |
| 791 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 792 | { |
| 793 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 794 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 795 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 796 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "bar", |
| 797 | Localscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Local.: true, |
| 798 | }, |
| 799 | }, |
| 800 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 801 | return nil |
| 802 | }, |
| 803 | }, |
| 804 | }, |
| 805 | } |
| 806 | |
| 807 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 808 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = output |
| 809 | |
| 810 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "frobbly", "--help"}) |
| 811 | |
| 812 | expected := `NAME: |
| 813 | foo frobbly |
| 814 | |
| 815 | USAGE: |
| 816 | foo frobbly [options] |
| 817 | |
| 818 | OPTIONS: |
| 819 | --bar string |
| 820 | --help, -h show help |
| 821 | |
| 822 | GLOBAL OPTIONS: |
| 823 | --foo string |
| 824 | ` |
| 825 | |
| 826 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), expected, "expected output to include global options") |
| 827 | } |
| 828 | |
| 829 | func TestShowSubcommandHelp_GlobalOptions_HideHelpCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowSubcommandHelp_GlobalOptions_HideHelpCommand().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 830 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 831 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 832 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 833 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "foo", |
| 834 | }, |
| 835 | }, |
| 836 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 837 | { |
| 838 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 839 | HideHelpCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelpCommand.: true, |
| 840 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 841 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 842 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "bar", |
| 843 | Localscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Local.: true, |
| 844 | }, |
| 845 | }, |
| 846 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 847 | return nil |
| 848 | }, |
| 849 | }, |
| 850 | }, |
| 851 | } |
| 852 | |
| 853 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 854 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = output |
| 855 | |
| 856 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "frobbly", "--help"}) |
| 857 | |
| 858 | expected := `NAME: |
| 859 | foo frobbly |
| 860 | |
| 861 | USAGE: |
| 862 | foo frobbly [options] |
| 863 | |
| 864 | OPTIONS: |
| 865 | --bar string |
| 866 | --help, -h show help |
| 867 | |
| 868 | GLOBAL OPTIONS: |
| 869 | --foo string |
| 870 | ` |
| 871 | |
| 872 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), expected, "expected output to include global options") |
| 873 | } |
| 874 | |
| 875 | func TestShowSubcommandHelp_SubcommandUsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowSubcommandHelp_SubcommandUsageText().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 876 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 877 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 878 | { |
| 879 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 880 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 881 | { |
| 882 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "bobbly", |
| 883 | UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UsageText.: "this is usage text", |
| 884 | }, |
| 885 | }, |
| 886 | }, |
| 887 | }, |
| 888 | } |
| 889 | |
| 890 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 891 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = output |
| 892 | |
| 893 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "frobbly", "bobbly", "--help"}) |
| 894 | |
| 895 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "this is usage text", |
| 896 | "expected output to include usage text") |
| 897 | } |
| 898 | |
| 899 | func TestShowSubcommandHelp_MultiLine_SubcommandUsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowSubcommandHelp_MultiLine_SubcommandUsageText().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 900 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 901 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 902 | { |
| 903 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 904 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 905 | { |
| 906 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "bobbly", |
| 907 | UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UsageText.: `This is a |
| 908 | multi |
| 909 | line |
| 910 | UsageText`, |
| 911 | }, |
| 912 | }, |
| 913 | }, |
| 914 | }, |
| 915 | } |
| 916 | |
| 917 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 918 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = output |
| 919 | |
| 920 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "frobbly", "bobbly", "--help"}) |
| 921 | |
| 922 | expected := `USAGE: |
| 923 | This is a |
| 924 | multi |
| 925 | line |
| 926 | UsageText |
| 927 | ` |
| 928 | |
| 929 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), expected, |
| 930 | "expected output to include usage text") |
| 931 | } |
| 932 | |
| 933 | func TestShowRootCommandHelp_HiddenCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowRootCommandHelp_HiddenCommand().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 934 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 935 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 936 | { |
| 937 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 938 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 939 | return nil |
| 940 | }, |
| 941 | }, |
| 942 | { |
| 943 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "secretfrob", |
| 944 | Hiddenscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Hidden.: true, |
| 945 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 946 | return nil |
| 947 | }, |
| 948 | }, |
| 949 | }, |
| 950 | } |
| 951 | |
| 952 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 953 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = output |
| 954 | |
| 955 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"app", "--help"}) |
| 956 | |
| 957 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotContains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "secretfrob", |
| 958 | "expected output to exclude \"secretfrob\"") |
| 959 | |
| 960 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "frobbly", |
| 961 | "expected output to include \"frobbly\"") |
| 962 | } |
| 963 | |
| 964 | func TestShowRootCommandHelp_HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowRootCommandHelp_HelpPrinter().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 965 | doublecho := func(text string) string { |
| 966 | return text + " " + text |
| 967 | } |
| 968 | |
| 969 | tests := []struct { |
| 970 | name string |
| 971 | template string |
| 972 | printer HelpPrinterFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterFunc# |
| 973 | wantTemplate string |
| 974 | wantOutput string |
| 975 | }{ |
| 976 | { |
| 977 | name: "standard-command", |
| 978 | template: "", |
| 979 | printer: func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, _ string, _ any) { |
| 980 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Fprintscip-go gomod github.com/golang/go/src go1.22 fmt/Fprint().(w, "yo") |
| 981 | }, |
| 982 | wantTemplate: RootCommandHelpTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/RootCommandHelpTemplate., |
| 983 | wantOutput: "yo", |
| 984 | }, |
| 985 | { |
| 986 | name: "custom-template-command", |
| 987 | template: "{{doublecho .Name}}", |
| 988 | printer: func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, templ string, data any) { |
| 989 | // Pass a custom function to ensure it gets used |
| 990 | fm := map[string]any{"doublecho": doublecho} |
| 991 | DefaultPrintHelpCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DefaultPrintHelpCustom().(w, templ, data, fm) |
| 992 | }, |
| 993 | wantTemplate: "{{doublecho .Name}}", |
| 994 | wantOutput: "my-app my-app", |
| 995 | }, |
| 996 | } |
| 997 | |
| 998 | for _, tt := range tests { |
| 999 | t.Runscip-go gomod github.com/golang/go/src go1.22 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1000 | defer func(old HelpPrinterFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterFunc#) { |
| 1001 | HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter. = old |
| 1002 | }(HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter.) |
| 1003 | HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter. = func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, templ string, data any) { |
| 1004 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, tt.wantTemplate, templ, "unexpected template") |
| 1005 | tt.printer(w, templ, data) |
| 1006 | } |
| 1007 | |
| 1008 | var buf bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer# |
| 1009 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1010 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "my-app", |
| 1011 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: &buf, |
| 1012 | CustomRootCommandHelpTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#CustomRootCommandHelpTemplate.: tt.template, |
| 1013 | } |
| 1014 | |
| 1015 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"my-app", "help"}) |
| 1016 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 1017 | |
| 1018 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, tt.wantOutput, buf.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().()) |
| 1019 | }) |
| 1020 | } |
| 1021 | } |
| 1022 | |
| 1023 | func TestShowRootCommandHelp_HelpPrinterCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowRootCommandHelp_HelpPrinterCustom().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1024 | doublecho := func(text string) string { |
| 1025 | return text + " " + text |
| 1026 | } |
| 1027 | |
| 1028 | tests := []struct { |
| 1029 | name string |
| 1030 | template string |
| 1031 | printer HelpPrinterCustomFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustomFunc# |
| 1032 | wantTemplate string |
| 1033 | wantOutput string |
| 1034 | }{ |
| 1035 | { |
| 1036 | name: "standard-command", |
| 1037 | template: "", |
| 1038 | printer: func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, _ string, _ any, _ map[string]any) { |
| 1039 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Fprintscip-go gomod github.com/golang/go/src go1.22 fmt/Fprint().(w, "yo") |
| 1040 | }, |
| 1041 | wantTemplate: RootCommandHelpTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/RootCommandHelpTemplate., |
| 1042 | wantOutput: "yo", |
| 1043 | }, |
| 1044 | { |
| 1045 | name: "custom-template-command", |
| 1046 | template: "{{doublecho .Name}}", |
| 1047 | printer: func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, templ string, data any, _ map[string]any) { |
| 1048 | // Pass a custom function to ensure it gets used |
| 1049 | fm := map[string]any{"doublecho": doublecho} |
| 1050 | DefaultPrintHelpCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DefaultPrintHelpCustom().(w, templ, data, fm) |
| 1051 | }, |
| 1052 | wantTemplate: "{{doublecho .Name}}", |
| 1053 | wantOutput: "my-app my-app", |
| 1054 | }, |
| 1055 | } |
| 1056 | |
| 1057 | for _, tt := range tests { |
| 1058 | t.Runscip-go gomod github.com/golang/go/src go1.22 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1059 | defer func(old HelpPrinterCustomFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustomFunc#) { |
| 1060 | HelpPrinterCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustom. = old |
| 1061 | }(HelpPrinterCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustom.) |
| 1062 | HelpPrinterCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustom. = func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, templ string, data any, fm map[string]any) { |
| 1063 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, fm, "unexpected function map passed") |
| 1064 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, tt.wantTemplate, templ, "unexpected template") |
| 1065 | tt.printer(w, templ, data, fm) |
| 1066 | } |
| 1067 | |
| 1068 | var buf bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer# |
| 1069 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1070 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "my-app", |
| 1071 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: &buf, |
| 1072 | CustomRootCommandHelpTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#CustomRootCommandHelpTemplate.: tt.template, |
| 1073 | } |
| 1074 | |
| 1075 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"my-app", "help"}) |
| 1076 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 1077 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, tt.wantOutput, buf.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().()) |
| 1078 | }) |
| 1079 | } |
| 1080 | } |
| 1081 | |
| 1082 | func TestShowRootCommandHelp_CustomAppTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowRootCommandHelp_CustomAppTemplate().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1083 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1084 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1085 | { |
| 1086 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 1087 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 1088 | return nil |
| 1089 | }, |
| 1090 | }, |
| 1091 | { |
| 1092 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "secretfrob", |
| 1093 | Hiddenscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Hidden.: true, |
| 1094 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 1095 | return nil |
| 1096 | }, |
| 1097 | }, |
| 1098 | }, |
| 1099 | ExtraInfoscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ExtraInfo.: func() map[string]string { |
| 1100 | platform := fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.22 fmt/Sprintf().("OS: %s | Arch: %s", runtimescip-go gomod github.com/golang/go/src go1.22 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.22 runtime/GOOS., runtimescip-go gomod github.com/golang/go/src go1.22 runtime/.GOARCHscip-go gomod github.com/golang/go/src go1.22 runtime/GOARCH.) |
| 1101 | goruntime := fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.22 fmt/Sprintf().("Version: %s | CPUs: %d", runtimescip-go gomod github.com/golang/go/src go1.22 runtime/.Versionscip-go gomod github.com/golang/go/src go1.22 runtime/Version().(), runtimescip-go gomod github.com/golang/go/src go1.22 runtime/.NumCPUscip-go gomod github.com/golang/go/src go1.22 runtime/NumCPU().()) |
| 1102 | return map[string]string{ |
| 1103 | "PLATFORM": platform, |
| 1104 | "RUNTIME": goruntime, |
| 1105 | } |
| 1106 | }, |
| 1107 | CustomRootCommandHelpTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#CustomRootCommandHelpTemplate.: `NAME: |
| 1108 | {{.Name}} - {{.Usage}} |
| 1109 | |
| 1110 | USAGE: |
| 1111 | {{.Name}} {{if .VisibleFlags}}[FLAGS] {{end}}COMMAND{{if .VisibleFlags}} [COMMAND FLAGS | -h]{{end}} [ARGUMENTS...] |
| 1112 | |
| 1113 | COMMANDS: |
| 1114 | {{range .VisibleCommands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}} |
| 1115 | {{end}}{{if .VisibleFlags}} |
| 1116 | GLOBAL FLAGS: |
| 1117 | {{range .VisibleFlags}}{{.}} |
| 1118 | {{end}}{{end}} |
| 1119 | VERSION: |
| 1120 | 2.0.0 |
| 1121 | {{"\n"}}{{range $key, $value := ExtraInfo}} |
| 1122 | {{$key}}: |
| 1123 | {{$value}} |
| 1124 | {{end}}`, |
| 1125 | } |
| 1126 | |
| 1127 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 1128 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = output |
| 1129 | |
| 1130 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"app", "--help"}) |
| 1131 | |
| 1132 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotContains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "secretfrob", "expected output to exclude \"secretfrob\"") |
| 1133 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "frobbly", "expected output to include \"frobbly\"") |
| 1134 | |
| 1135 | if !stringsscip-go gomod github.com/golang/go/src go1.22 strings/.Containsscip-go gomod github.com/golang/go/src go1.22 strings/Contains().(output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "PLATFORM:") || |
| 1136 | !stringsscip-go gomod github.com/golang/go/src go1.22 strings/.Containsscip-go gomod github.com/golang/go/src go1.22 strings/Contains().(output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "OS:") || |
| 1137 | !stringsscip-go gomod github.com/golang/go/src go1.22 strings/.Containsscip-go gomod github.com/golang/go/src go1.22 strings/Contains().(output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "Arch:") { |
| 1138 | t.Errorfscip-go gomod github.com/golang/go/src go1.22 testing/common#Errorf().("expected output to include \"PLATFORM:, OS: and Arch:\"; got: %q", output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().()) |
| 1139 | } |
| 1140 | |
| 1141 | if !stringsscip-go gomod github.com/golang/go/src go1.22 strings/.Containsscip-go gomod github.com/golang/go/src go1.22 strings/Contains().(output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "RUNTIME:") || |
| 1142 | !stringsscip-go gomod github.com/golang/go/src go1.22 strings/.Containsscip-go gomod github.com/golang/go/src go1.22 strings/Contains().(output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "Version:") || |
| 1143 | !stringsscip-go gomod github.com/golang/go/src go1.22 strings/.Containsscip-go gomod github.com/golang/go/src go1.22 strings/Contains().(output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "CPUs:") { |
| 1144 | t.Errorfscip-go gomod github.com/golang/go/src go1.22 testing/common#Errorf().("expected output to include \"RUNTIME:, Version: and CPUs:\"; got: %q", output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().()) |
| 1145 | } |
| 1146 | |
| 1147 | if !stringsscip-go gomod github.com/golang/go/src go1.22 strings/.Containsscip-go gomod github.com/golang/go/src go1.22 strings/Contains().(output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "VERSION:") || |
| 1148 | !stringsscip-go gomod github.com/golang/go/src go1.22 strings/.Containsscip-go gomod github.com/golang/go/src go1.22 strings/Contains().(output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "2.0.0") { |
| 1149 | t.Errorfscip-go gomod github.com/golang/go/src go1.22 testing/common#Errorf().("expected output to include \"VERSION:, 2.0.0\"; got: %q", output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().()) |
| 1150 | } |
| 1151 | } |
| 1152 | |
| 1153 | func TestShowRootCommandHelp_UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowRootCommandHelp_UsageText().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1154 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1155 | UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UsageText.: "This is a single line of UsageText", |
| 1156 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1157 | { |
| 1158 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 1159 | }, |
| 1160 | }, |
| 1161 | } |
| 1162 | |
| 1163 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 1164 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = output |
| 1165 | |
| 1166 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo"}) |
| 1167 | |
| 1168 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "This is a single line of UsageText", "expected output to include usage text") |
| 1169 | } |
| 1170 | |
| 1171 | func TestShowRootCommandHelp_MultiLine_UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowRootCommandHelp_MultiLine_UsageText().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1172 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1173 | UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UsageText.: `This is a |
| 1174 | multi |
| 1175 | line |
| 1176 | App UsageText`, |
| 1177 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1178 | { |
| 1179 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 1180 | }, |
| 1181 | }, |
| 1182 | } |
| 1183 | |
| 1184 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 1185 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = output |
| 1186 | |
| 1187 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo"}) |
| 1188 | |
| 1189 | expected := `USAGE: |
| 1190 | This is a |
| 1191 | multi |
| 1192 | line |
| 1193 | App UsageText |
| 1194 | ` |
| 1195 | |
| 1196 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), expected, "expected output to include usage text") |
| 1197 | } |
| 1198 | |
| 1199 | func TestShowRootCommandHelp_CommandMultiLine_UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestShowRootCommandHelp_CommandMultiLine_UsageText().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1200 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1201 | UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UsageText.: `This is a |
| 1202 | multi |
| 1203 | line |
| 1204 | App UsageText`, |
| 1205 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1206 | { |
| 1207 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "frobbly", |
| 1208 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"frb1", "frbb2", "frl2"}, |
| 1209 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "this is a long help output for the run command, long usage \noutput, long usage output, long usage output, long usage output\noutput, long usage output, long usage output", |
| 1210 | }, |
| 1211 | { |
| 1212 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "grobbly", |
| 1213 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"grb1", "grbb2"}, |
| 1214 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "this is another long help output for the run command, long usage \noutput, long usage output", |
| 1215 | }, |
| 1216 | }, |
| 1217 | } |
| 1218 | |
| 1219 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 1220 | cmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = output |
| 1221 | |
| 1222 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo"}) |
| 1223 | |
| 1224 | expected := "COMMANDS:\n" + |
| 1225 | " frobbly, frb1, frbb2, frl2 this is a long help output for the run command, long usage \n" + |
| 1226 | " output, long usage output, long usage output, long usage output\n" + |
| 1227 | " output, long usage output, long usage output\n" + |
| 1228 | " grobbly, grb1, grbb2 this is another long help output for the run command, long usage \n" + |
| 1229 | " output, long usage output" |
| 1230 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), expected, "expected output to include usage text") |
| 1231 | } |
| 1232 | |
| 1233 | func TestHideHelpCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestHideHelpCommand().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1234 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1235 | HideHelpCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelpCommand.: true, |
| 1236 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: ioscip-go gomod github.com/golang/go/src go1.22 io/.Discardscip-go gomod github.com/golang/go/src go1.22 io/Discard., |
| 1237 | } |
| 1238 | |
| 1239 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "help"}) |
| 1240 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.ErrorContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/ErrorContains().(t, err, "No help topic for 'help'") |
| 1241 | |
| 1242 | err = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "--help"}) |
| 1243 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 1244 | } |
| 1245 | |
| 1246 | func TestHideHelpCommand_Falsescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestHideHelpCommand_False().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1247 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1248 | HideHelpCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelpCommand.: false, |
| 1249 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: ioscip-go gomod github.com/golang/go/src go1.22 io/.Discardscip-go gomod github.com/golang/go/src go1.22 io/Discard., |
| 1250 | } |
| 1251 | |
| 1252 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "help"}) |
| 1253 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 1254 | |
| 1255 | err = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "--help"}) |
| 1256 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 1257 | } |
| 1258 | |
| 1259 | func TestHideHelpCommand_WithHideHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestHideHelpCommand_WithHideHelp().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1260 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1261 | HideHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelp.: true, // effective (hides both command and flag) |
| 1262 | HideHelpCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelpCommand.: true, // ignored |
| 1263 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: ioscip-go gomod github.com/golang/go/src go1.22 io/.Discardscip-go gomod github.com/golang/go/src go1.22 io/Discard., |
| 1264 | } |
| 1265 | |
| 1266 | err := cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "help"}) |
| 1267 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.ErrorContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/ErrorContains().(t, err, "No help topic for 'help'") |
| 1268 | |
| 1269 | err = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "--help"}) |
| 1270 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.ErrorContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/ErrorContains().(t, err, providedButNotDefinedErrMsgscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/providedButNotDefinedErrMsg.) |
| 1271 | } |
| 1272 | |
| 1273 | func TestHideHelpCommand_WithSubcommandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestHideHelpCommand_WithSubcommands().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1274 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1275 | HideHelpCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelpCommand.: true, |
| 1276 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1277 | { |
| 1278 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "nully", |
| 1279 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1280 | { |
| 1281 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "nully2", |
| 1282 | }, |
| 1283 | }, |
| 1284 | }, |
| 1285 | }, |
| 1286 | } |
| 1287 | |
| 1288 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 1289 | |
| 1290 | r.ErrorContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#ErrorContains().(cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"cli.test", "help"}), "No help topic for 'help'") |
| 1291 | r.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NoError().(cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"cli.test", "--help"})) |
| 1292 | } |
| 1293 | |
| 1294 | func TestDefaultCompleteWithFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestDefaultCompleteWithFlags().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1295 | origArgv := osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. |
| 1296 | t.Cleanupscip-go gomod github.com/golang/go/src go1.22 testing/common#Cleanup().(func() { osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = origArgv }) |
| 1297 | |
| 1298 | for _, tc := range []struct { |
| 1299 | name string |
| 1300 | cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command# |
| 1301 | argv []string |
| 1302 | env map[string]string |
| 1303 | expected string |
| 1304 | }{ |
| 1305 | { |
| 1306 | name: "empty", |
| 1307 | cmd: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{}, |
| 1308 | argv: []string{"prog", "cmd"}, |
| 1309 | env: map[string]string{"SHELL": "bash"}, |
| 1310 | expected: "", |
| 1311 | }, |
| 1312 | { |
| 1313 | name: "typical-flag-suggestion", |
| 1314 | cmd: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1315 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1316 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "excitement"}, |
| 1317 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "hat-shape"}, |
| 1318 | }, |
| 1319 | parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent.: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1320 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "cmd", |
| 1321 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1322 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "happiness"}, |
| 1323 | &Int64Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64Flag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "everybody-jump-on"}, |
| 1324 | }, |
| 1325 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1326 | {Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "putz"}, |
| 1327 | }, |
| 1328 | }, |
| 1329 | }, |
| 1330 | argv: []string{"cmd", "--e", completionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/completionFlag.}, |
| 1331 | env: map[string]string{"SHELL": "bash"}, |
| 1332 | expected: "--excitement\n", |
| 1333 | }, |
| 1334 | { |
| 1335 | name: "typical-flag-suggestion-hidden-bool", |
| 1336 | cmd: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1337 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1338 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "excitement", Hiddenscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Hidden.: true}, |
| 1339 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "hat-shape"}, |
| 1340 | }, |
| 1341 | parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent.: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1342 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "cmd", |
| 1343 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1344 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "happiness"}, |
| 1345 | &Int64Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64Flag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "everybody-jump-on"}, |
| 1346 | }, |
| 1347 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1348 | {Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "putz"}, |
| 1349 | }, |
| 1350 | }, |
| 1351 | }, |
| 1352 | argv: []string{"cmd", "--e", completionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/completionFlag.}, |
| 1353 | env: map[string]string{"SHELL": "bash"}, |
| 1354 | expected: "", |
| 1355 | }, |
| 1356 | { |
| 1357 | name: "flag-suggestion-double-dash-shows-all-flags", |
| 1358 | cmd: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1359 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1360 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "excitement"}, |
| 1361 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "hat-shape"}, |
| 1362 | }, |
| 1363 | parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent.: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1364 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "cmd", |
| 1365 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1366 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "happiness"}, |
| 1367 | &Int64Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64Flag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "everybody-jump-on"}, |
| 1368 | }, |
| 1369 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1370 | {Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "putz"}, |
| 1371 | }, |
| 1372 | }, |
| 1373 | }, |
| 1374 | argv: []string{"cmd", "--e", "--", completionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/completionFlag.}, |
| 1375 | env: map[string]string{"SHELL": "bash"}, |
| 1376 | expected: "--excitement\n--hat-shape\n", |
| 1377 | }, |
| 1378 | { |
| 1379 | name: "typical-command-suggestion", |
| 1380 | cmd: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1381 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "putz", |
| 1382 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1383 | {Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "futz"}, |
| 1384 | }, |
| 1385 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1386 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "excitement"}, |
| 1387 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "hat-shape"}, |
| 1388 | }, |
| 1389 | parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent.: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1390 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "cmd", |
| 1391 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1392 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "happiness"}, |
| 1393 | &Int64Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64Flag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "everybody-jump-on"}, |
| 1394 | }, |
| 1395 | }, |
| 1396 | }, |
| 1397 | argv: []string{"cmd", completionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/completionFlag.}, |
| 1398 | env: map[string]string{"SHELL": "bash"}, |
| 1399 | expected: "futz\n", |
| 1400 | }, |
| 1401 | { |
| 1402 | name: "autocomplete-with-spaces", |
| 1403 | cmd: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1404 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "putz", |
| 1405 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1406 | {Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "help"}, |
| 1407 | }, |
| 1408 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1409 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "excitement"}, |
| 1410 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "hat-shape"}, |
| 1411 | }, |
| 1412 | parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent.: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1413 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "cmd", |
| 1414 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1415 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "happiness"}, |
| 1416 | &Int64Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64Flag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "everybody-jump-on"}, |
| 1417 | }, |
| 1418 | }, |
| 1419 | }, |
| 1420 | argv: []string{"cmd", "--url", "http://localhost:8000", "h", completionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/completionFlag.}, |
| 1421 | env: map[string]string{"SHELL": "bash"}, |
| 1422 | expected: "help\n", |
| 1423 | }, |
| 1424 | { |
| 1425 | name: "zsh-autocomplete-with-flag-descriptions", |
| 1426 | cmd: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1427 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "putz", |
| 1428 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1429 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "excitement", Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Usage.: "an exciting flag"}, |
| 1430 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "hat-shape"}, |
| 1431 | }, |
| 1432 | parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent.: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1433 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "cmd", |
| 1434 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1435 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "happiness"}, |
| 1436 | &Int64Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64Flag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "everybody-jump-on"}, |
| 1437 | }, |
| 1438 | }, |
| 1439 | }, |
| 1440 | argv: []string{"cmd", "putz", "-e", completionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/completionFlag.}, |
| 1441 | env: map[string]string{"SHELL": "zsh"}, |
| 1442 | expected: "--excitement:an exciting flag\n", |
| 1443 | }, |
| 1444 | { |
| 1445 | name: "zsh-autocomplete-with-empty-flag-descriptions", |
| 1446 | cmd: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1447 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "putz", |
| 1448 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1449 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "excitement"}, |
| 1450 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "hat-shape"}, |
| 1451 | }, |
| 1452 | parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent.: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1453 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "cmd", |
| 1454 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1455 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "happiness"}, |
| 1456 | &Int64Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64Flag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "everybody-jump-on"}, |
| 1457 | }, |
| 1458 | }, |
| 1459 | }, |
| 1460 | argv: []string{"cmd", "putz", "-e", completionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/completionFlag.}, |
| 1461 | env: map[string]string{"SHELL": "zsh"}, |
| 1462 | expected: "--excitement\n", |
| 1463 | }, |
| 1464 | } { |
| 1465 | t.Runscip-go gomod github.com/golang/go/src go1.22 testing/T#Run().(tc.name, func(ct *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1466 | writer := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 1467 | rootCmd := tc.cmd.Rootscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Root().() |
| 1468 | rootCmd.Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer. = writer |
| 1469 | |
| 1470 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = tc.argv |
| 1471 | for k, v := range tc.env { |
| 1472 | ct.Setenvscip-go gomod github.com/golang/go/src go1.22 testing/T#Setenv().(k, v) |
| 1473 | } |
| 1474 | tc.cmd.parsedArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parsedArgs. = &stringSliceArgsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/stringSliceArgs#{ |
| 1475 | tc.argv[1:], |
| 1476 | } |
| 1477 | f := DefaultCompleteWithFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DefaultCompleteWithFlags(). |
| 1478 | f(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(ct), tc.cmd) |
| 1479 | |
| 1480 | written := writer.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().() |
| 1481 | |
| 1482 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(ct, tc.expected, written, "written help does not match") |
| 1483 | }) |
| 1484 | } |
| 1485 | } |
| 1486 | |
| 1487 | func TestMutuallyExclusiveFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestMutuallyExclusiveFlags().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1488 | writer := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 1489 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1490 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "cmd", |
| 1491 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: writer, |
| 1492 | MutuallyExclusiveFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#MutuallyExclusiveFlags.: []MutuallyExclusiveFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/MutuallyExclusiveFlags#{ |
| 1493 | { |
| 1494 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/MutuallyExclusiveFlags#Flags.: [][]Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1495 | { |
| 1496 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 1497 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "s1", |
| 1498 | }, |
| 1499 | }, |
| 1500 | }, |
| 1501 | }, |
| 1502 | }, |
| 1503 | } |
| 1504 | |
| 1505 | _ = ShowRootCommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ShowRootCommandHelp.(cmd) |
| 1506 | |
| 1507 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, writer.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "--s1", "written help does not include mutex flag") |
| 1508 | } |
| 1509 | |
| 1510 | func TestWrapscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestWrap().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1511 | emptywrap := wrapscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/wrap().("", 4, 16) |
| 1512 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Emptyscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Empty().(t, emptywrap, "Wrapping empty line should return empty line") |
| 1513 | } |
| 1514 | |
| 1515 | func TestWrappedHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestWrappedHelp().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1516 | // Reset HelpPrinter after this test. |
| 1517 | defer func(old HelpPrinterFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterFunc#) { |
| 1518 | HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter. = old |
| 1519 | }(HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter.) |
| 1520 | |
| 1521 | output := new(bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#) |
| 1522 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1523 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output, |
| 1524 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1525 | &BoolFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolFlag#{ |
| 1526 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "foo", |
| 1527 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"h"}, |
| 1528 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Usage.: "here's a really long help text line, let's see where it wraps. blah blah blah and so on.", |
| 1529 | }, |
| 1530 | }, |
| 1531 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "here's a sample App.Usage string long enough that it should be wrapped in this test", |
| 1532 | UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UsageText.: "i'm not sure how App.UsageText differs from App.Usage, but this should also be wrapped in this test", |
| 1533 | // TODO: figure out how to make ArgsUsage appear in the help text, and test that |
| 1534 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: `here's a sample App.Description string long enough that it should be wrapped in this test |
| 1535 | |
| 1536 | with a newline |
| 1537 | and an indented line`, |
| 1538 | Copyrightscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Copyright.: `Here's a sample copyright text string long enough that it should be wrapped. |
| 1539 | Including newlines. |
| 1540 | And also indented lines. |
| 1541 | |
| 1542 | |
| 1543 | And then another long line. Blah blah blah does anybody ever read these things?`, |
| 1544 | } |
| 1545 | |
| 1546 | HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter. = func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, templ string, data any) { |
| 1547 | funcMap := map[string]any{ |
| 1548 | "wrapAt": func() int { |
| 1549 | return 30 |
| 1550 | }, |
| 1551 | } |
| 1552 | |
| 1553 | HelpPrinterCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustom.(w, templ, data, funcMap) |
| 1554 | } |
| 1555 | |
| 1556 | _ = ShowRootCommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ShowRootCommandHelp.(cmd) |
| 1557 | |
| 1558 | expected := `NAME: |
| 1559 | - here's a sample |
| 1560 | App.Usage string long |
| 1561 | enough that it should be |
| 1562 | wrapped in this test |
| 1563 | |
| 1564 | USAGE: |
| 1565 | i'm not sure how |
| 1566 | App.UsageText differs from |
| 1567 | App.Usage, but this should |
| 1568 | also be wrapped in this |
| 1569 | test |
| 1570 | |
| 1571 | DESCRIPTION: |
| 1572 | here's a sample |
| 1573 | App.Description string long |
| 1574 | enough that it should be |
| 1575 | wrapped in this test |
| 1576 | |
| 1577 | with a newline |
| 1578 | and an indented line |
| 1579 | |
| 1580 | GLOBAL OPTIONS: |
| 1581 | --foo, -h here's a |
| 1582 | really long help text |
| 1583 | line, let's see where it |
| 1584 | wraps. blah blah blah |
| 1585 | and so on. |
| 1586 | |
| 1587 | COPYRIGHT: |
| 1588 | Here's a sample copyright |
| 1589 | text string long enough |
| 1590 | that it should be wrapped. |
| 1591 | Including newlines. |
| 1592 | And also indented lines. |
| 1593 | |
| 1594 | |
| 1595 | And then another long line. |
| 1596 | Blah blah blah does anybody |
| 1597 | ever read these things? |
| 1598 | ` |
| 1599 | |
| 1600 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, expected, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "Unexpected wrapping") |
| 1601 | } |
| 1602 | |
| 1603 | func TestWrappedCommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestWrappedCommandHelp().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1604 | // Reset HelpPrinter after this test. |
| 1605 | defer func(old HelpPrinterFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterFunc#) { |
| 1606 | HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter. = old |
| 1607 | }(HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter.) |
| 1608 | |
| 1609 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 1610 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1611 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output, |
| 1612 | ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ErrWriter.: output, |
| 1613 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1614 | { |
| 1615 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "add", |
| 1616 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"a"}, |
| 1617 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "add a task to the list", |
| 1618 | UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UsageText.: "this is an even longer way of describing adding a task to the list", |
| 1619 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "and a description long enough to wrap in this test case", |
| 1620 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 1621 | return nil |
| 1622 | }, |
| 1623 | }, |
| 1624 | }, |
| 1625 | } |
| 1626 | cmd.setupDefaultsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#setupDefaults().([]string{"cli.test"}) |
| 1627 | cmd.setupCommandGraphscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#setupCommandGraph().() |
| 1628 | |
| 1629 | HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter. = func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, templ string, data any) { |
| 1630 | funcMap := map[string]any{ |
| 1631 | "wrapAt": func() int { |
| 1632 | return 30 |
| 1633 | }, |
| 1634 | } |
| 1635 | |
| 1636 | HelpPrinterCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustom.(w, templ, data, funcMap) |
| 1637 | } |
| 1638 | |
| 1639 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 1640 | |
| 1641 | r.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NoError().(ShowCommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ShowCommandHelp.(contextscip-go gomod github.com/golang/go/src go1.22 context/.Backgroundscip-go gomod github.com/golang/go/src go1.22 context/Background().(), cmd, "add")) |
| 1642 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(`NAME: |
| 1643 | cli.test add - add a task |
| 1644 | to the list |
| 1645 | |
| 1646 | USAGE: |
| 1647 | this is an even longer way |
| 1648 | of describing adding a task |
| 1649 | to the list |
| 1650 | |
| 1651 | DESCRIPTION: |
| 1652 | and a description long |
| 1653 | enough to wrap in this test |
| 1654 | case |
| 1655 | |
| 1656 | OPTIONS: |
| 1657 | --help, -h show help |
| 1658 | `, |
| 1659 | output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), |
| 1660 | ) |
| 1661 | } |
| 1662 | |
| 1663 | func TestWrappedSubcommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestWrappedSubcommandHelp().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1664 | // Reset HelpPrinter after this test. |
| 1665 | defer func(old HelpPrinterFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterFunc#) { |
| 1666 | HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter. = old |
| 1667 | }(HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter.) |
| 1668 | |
| 1669 | output := new(bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#) |
| 1670 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1671 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "cli.test", |
| 1672 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output, |
| 1673 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1674 | { |
| 1675 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "bar", |
| 1676 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"a"}, |
| 1677 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "add a task to the list", |
| 1678 | UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UsageText.: "this is an even longer way of describing adding a task to the list", |
| 1679 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "and a description long enough to wrap in this test case", |
| 1680 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 1681 | return nil |
| 1682 | }, |
| 1683 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1684 | { |
| 1685 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "grok", |
| 1686 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "remove an existing template", |
| 1687 | UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UsageText.: "longer usage text goes here, la la la, hopefully this is long enough to wrap even more", |
| 1688 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 1689 | return nil |
| 1690 | }, |
| 1691 | }, |
| 1692 | }, |
| 1693 | }, |
| 1694 | }, |
| 1695 | } |
| 1696 | |
| 1697 | HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter. = func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, templ string, data any) { |
| 1698 | funcMap := map[string]any{ |
| 1699 | "wrapAt": func() int { |
| 1700 | return 30 |
| 1701 | }, |
| 1702 | } |
| 1703 | |
| 1704 | HelpPrinterCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustom.(w, templ, data, funcMap) |
| 1705 | } |
| 1706 | |
| 1707 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"foo", "bar", "grok", "--help"}) |
| 1708 | |
| 1709 | expected := `NAME: |
| 1710 | cli.test bar grok - remove |
| 1711 | an |
| 1712 | existing |
| 1713 | template |
| 1714 | |
| 1715 | USAGE: |
| 1716 | longer usage text goes |
| 1717 | here, la la la, hopefully |
| 1718 | this is long enough to wrap |
| 1719 | even more |
| 1720 | |
| 1721 | OPTIONS: |
| 1722 | --help, -h show help |
| 1723 | ` |
| 1724 | |
| 1725 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, expected, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "Unexpected wrapping") |
| 1726 | } |
| 1727 | |
| 1728 | func TestWrappedHelpSubcommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestWrappedHelpSubcommand().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1729 | // Reset HelpPrinter after this test. |
| 1730 | defer func(old HelpPrinterFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterFunc#) { |
| 1731 | HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter. = old |
| 1732 | }(HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter.) |
| 1733 | |
| 1734 | output := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 1735 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1736 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "cli.test", |
| 1737 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output, |
| 1738 | ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ErrWriter.: output, |
| 1739 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1740 | { |
| 1741 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "bar", |
| 1742 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"a"}, |
| 1743 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "add a task to the list", |
| 1744 | UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UsageText.: "this is an even longer way of describing adding a task to the list", |
| 1745 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "and a description long enough to wrap in this test case", |
| 1746 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 1747 | return nil |
| 1748 | }, |
| 1749 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1750 | { |
| 1751 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "grok", |
| 1752 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "remove an existing template", |
| 1753 | UsageTextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#UsageText.: "longer usage text goes here, la la la, hopefully this is long enough to wrap even more", |
| 1754 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { |
| 1755 | return nil |
| 1756 | }, |
| 1757 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1758 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 1759 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "test-f", |
| 1760 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Usage.: "my test usage", |
| 1761 | }, |
| 1762 | }, |
| 1763 | }, |
| 1764 | }, |
| 1765 | }, |
| 1766 | }, |
| 1767 | } |
| 1768 | |
| 1769 | HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter. = func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, templ string, data any) { |
| 1770 | funcMap := map[string]any{ |
| 1771 | "wrapAt": func() int { |
| 1772 | return 30 |
| 1773 | }, |
| 1774 | } |
| 1775 | |
| 1776 | HelpPrinterCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustom.(w, templ, data, funcMap) |
| 1777 | } |
| 1778 | |
| 1779 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 1780 | |
| 1781 | r.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NoError().(cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"cli.test", "bar", "help", "grok"})) |
| 1782 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(`NAME: |
| 1783 | cli.test bar grok - remove |
| 1784 | an |
| 1785 | existing |
| 1786 | template |
| 1787 | |
| 1788 | USAGE: |
| 1789 | longer usage text goes |
| 1790 | here, la la la, hopefully |
| 1791 | this is long enough to wrap |
| 1792 | even more |
| 1793 | |
| 1794 | OPTIONS: |
| 1795 | --test-f string my test |
| 1796 | usage |
| 1797 | --help, -h show help |
| 1798 | `, |
| 1799 | output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), |
| 1800 | ) |
| 1801 | } |
| 1802 | |
| 1803 | func TestCategorizedHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestCategorizedHelp().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1804 | // Reset HelpPrinter after this test. |
| 1805 | defer func(old HelpPrinterFuncscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterFunc#) { |
| 1806 | HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter. = old |
| 1807 | }(HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter.) |
| 1808 | |
| 1809 | output := new(bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#) |
| 1810 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1811 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "cli.test", |
| 1812 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: output, |
| 1813 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(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 { return nil }, |
| 1814 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1815 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 1816 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "strd", // no category set |
| 1817 | }, |
| 1818 | &Int64Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64Flag#{ |
| 1819 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "intd", |
| 1820 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"altd1", "altd2"}, |
| 1821 | Categoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Category.: "cat1", |
| 1822 | }, |
| 1823 | &BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#{ |
| 1824 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Name.: "bf", |
| 1825 | // Category: "cat1", |
| 1826 | }, |
| 1827 | }, |
| 1828 | MutuallyExclusiveFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#MutuallyExclusiveFlags.: []MutuallyExclusiveFlagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/MutuallyExclusiveFlags#{ |
| 1829 | { |
| 1830 | Categoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/MutuallyExclusiveFlags#Category.: "cat1", |
| 1831 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/MutuallyExclusiveFlags#Flags.: [][]Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1832 | { |
| 1833 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 1834 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "m1", |
| 1835 | Categoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Category.: "overridden", |
| 1836 | }, |
| 1837 | }, |
| 1838 | }, |
| 1839 | }, |
| 1840 | { |
| 1841 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/MutuallyExclusiveFlags#Flags.: [][]Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 1842 | { |
| 1843 | &StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 1844 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "m2", |
| 1845 | Categoryscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Category.: "ignored", |
| 1846 | }, |
| 1847 | }, |
| 1848 | }, |
| 1849 | }, |
| 1850 | }, |
| 1851 | } |
| 1852 | |
| 1853 | HelpPrinterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinter. = func(w ioscip-go gomod github.com/golang/go/src go1.22 io/.Writerscip-go gomod github.com/golang/go/src go1.22 io/Writer#, templ string, data any) { |
| 1854 | funcMap := map[string]any{ |
| 1855 | "wrapAt": func() int { |
| 1856 | return 30 |
| 1857 | }, |
| 1858 | } |
| 1859 | |
| 1860 | HelpPrinterCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/HelpPrinterCustom.(w, templ, data, funcMap) |
| 1861 | } |
| 1862 | |
| 1863 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 1864 | r.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NoError().(cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"cli.test", "help"})) |
| 1865 | |
| 1866 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(`NAME: |
| 1867 | cli.test - A new cli |
| 1868 | application |
| 1869 | |
| 1870 | USAGE: |
| 1871 | cli.test [global options] |
| 1872 | |
| 1873 | GLOBAL OPTIONS: |
| 1874 | --[no-]bf (default: false) |
| 1875 | --help, -h show help |
| 1876 | --m2 string |
| 1877 | --strd string |
| 1878 | |
| 1879 | cat1 |
| 1880 | |
| 1881 | --intd int, --altd1 int, --altd2 int (default: 0) |
| 1882 | --m1 string |
| 1883 | |
| 1884 | `, output.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().()) |
| 1885 | } |
| 1886 | |
| 1887 | func Test_checkShellCompleteFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Test_checkShellCompleteFlag().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1888 | t.Parallelscip-go gomod github.com/golang/go/src go1.22 testing/T#Parallel().() |
| 1889 | tests := []struct { |
| 1890 | name string |
| 1891 | cmd *Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command# |
| 1892 | arguments []string |
| 1893 | wantShellCompletion bool |
| 1894 | wantArgs []string |
| 1895 | }{ |
| 1896 | { |
| 1897 | name: "disable-shell-completion", |
| 1898 | arguments: []string{completionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/completionFlag.}, |
| 1899 | cmd: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{}, |
| 1900 | wantShellCompletion: false, |
| 1901 | wantArgs: []string{completionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/completionFlag.}, |
| 1902 | }, |
| 1903 | { |
| 1904 | name: "child-disable-shell-completion", |
| 1905 | arguments: []string{completionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/completionFlag.}, |
| 1906 | cmd: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1907 | parentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#parent.: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{}, |
| 1908 | }, |
| 1909 | wantShellCompletion: false, |
| 1910 | wantArgs: []string{completionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/completionFlag.}, |
| 1911 | }, |
| 1912 | { |
| 1913 | name: "last argument isn't --generate-shell-completion", |
| 1914 | arguments: []string{"foo"}, |
| 1915 | cmd: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1916 | EnableShellCompletionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#EnableShellCompletion.: true, |
| 1917 | }, |
| 1918 | wantShellCompletion: false, |
| 1919 | wantArgs: []string{"foo"}, |
| 1920 | }, |
| 1921 | { |
| 1922 | name: "arguments include double dash", |
| 1923 | arguments: []string{"--", "foo", completionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/completionFlag.}, |
| 1924 | cmd: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1925 | EnableShellCompletionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#EnableShellCompletion.: true, |
| 1926 | }, |
| 1927 | wantShellCompletion: false, |
| 1928 | wantArgs: []string{"--", "foo"}, |
| 1929 | }, |
| 1930 | { |
| 1931 | name: "shell completion", |
| 1932 | arguments: []string{"foo", completionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/completionFlag.}, |
| 1933 | cmd: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1934 | EnableShellCompletionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#EnableShellCompletion.: true, |
| 1935 | }, |
| 1936 | wantShellCompletion: true, |
| 1937 | wantArgs: []string{"foo"}, |
| 1938 | }, |
| 1939 | { |
| 1940 | name: "double dash is the token being completed", |
| 1941 | arguments: []string{"foo", "--", completionFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/completionFlag.}, |
| 1942 | cmd: &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 1943 | EnableShellCompletionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#EnableShellCompletion.: true, |
| 1944 | }, |
| 1945 | wantShellCompletion: true, |
| 1946 | wantArgs: []string{"foo", "--"}, |
| 1947 | }, |
| 1948 | } |
| 1949 | |
| 1950 | for _, tt := range tests { |
| 1951 | tt := tt |
| 1952 | t.Runscip-go gomod github.com/golang/go/src go1.22 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1953 | t.Parallelscip-go gomod github.com/golang/go/src go1.22 testing/T#Parallel().() |
| 1954 | shellCompletion, args := checkShellCompleteFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/checkShellCompleteFlag().(tt.cmd, tt.arguments) |
| 1955 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, tt.wantShellCompletion, shellCompletion) |
| 1956 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, tt.wantArgs, args) |
| 1957 | }) |
| 1958 | } |
| 1959 | } |
| 1960 | |
| 1961 | func TestNIndentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestNIndent().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1962 | t.Parallelscip-go gomod github.com/golang/go/src go1.22 testing/T#Parallel().() |
| 1963 | tests := []struct { |
| 1964 | numSpaces int |
| 1965 | str string |
| 1966 | expected string |
| 1967 | }{ |
| 1968 | { |
| 1969 | numSpaces: 0, |
| 1970 | str: "foo", |
| 1971 | expected: "\nfoo", |
| 1972 | }, |
| 1973 | { |
| 1974 | numSpaces: 0, |
| 1975 | str: "foo\n", |
| 1976 | expected: "\nfoo\n", |
| 1977 | }, |
| 1978 | { |
| 1979 | numSpaces: 2, |
| 1980 | str: "foo", |
| 1981 | expected: "\n foo", |
| 1982 | }, |
| 1983 | { |
| 1984 | numSpaces: 3, |
| 1985 | str: "foo\n", |
| 1986 | expected: "\n foo\n ", |
| 1987 | }, |
| 1988 | } |
| 1989 | for _, test := range tests { |
| 1990 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, test.expected, nindentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/nindent().(test.numSpaces, test.str)) |
| 1991 | } |
| 1992 | } |
| 1993 | |
| 1994 | func TestTemplateErrorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestTemplateError().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 1995 | oldew := ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ErrWriter. |
| 1996 | defer func() { ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ErrWriter. = oldew }() |
| 1997 | |
| 1998 | var buf bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer# |
| 1999 | ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ErrWriter. = &buf |
| 2000 | err := errorsscip-go gomod github.com/golang/go/src go1.22 errors/.Newscip-go gomod github.com/golang/go/src go1.22 errors/New().("some error") |
| 2001 | |
| 2002 | handleTemplateErrorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/handleTemplateError().(err) |
| 2003 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, []byte(nil), buf.Bytesscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#Bytes().()) |
| 2004 | |
| 2005 | t.Setenvscip-go gomod github.com/golang/go/src go1.22 testing/T#Setenv().("CLI_TEMPLATE_ERROR_DEBUG", "true") |
| 2006 | handleTemplateErrorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/handleTemplateError().(err) |
| 2007 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, buf.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "CLI TEMPLATE ERROR") |
| 2008 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, buf.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), err.Error()) |
| 2009 | } |
| 2010 | |
| 2011 | func TestCliArgContainsFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestCliArgContainsFlag().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 2012 | tests := []struct { |
| 2013 | name string |
| 2014 | args []string |
| 2015 | contains bool |
| 2016 | }{ |
| 2017 | { |
| 2018 | name: "", |
| 2019 | args: []string{}, |
| 2020 | }, |
| 2021 | { |
| 2022 | name: "f", |
| 2023 | args: []string{}, |
| 2024 | }, |
| 2025 | { |
| 2026 | name: "f", |
| 2027 | args: []string{"g", "foo", "f"}, |
| 2028 | }, |
| 2029 | { |
| 2030 | name: "f", |
| 2031 | args: []string{"-f", "foo", "f"}, |
| 2032 | contains: true, |
| 2033 | }, |
| 2034 | { |
| 2035 | name: "f", |
| 2036 | args: []string{"g", "-f", "f"}, |
| 2037 | contains: true, |
| 2038 | }, |
| 2039 | { |
| 2040 | name: "fh", |
| 2041 | args: []string{"g", "f", "--fh"}, |
| 2042 | contains: true, |
| 2043 | }, |
| 2044 | { |
| 2045 | name: "fhg", |
| 2046 | args: []string{"-fhg", "f", "fh"}, |
| 2047 | }, |
| 2048 | { |
| 2049 | name: "fhg", |
| 2050 | args: []string{"--fhg", "f", "fh"}, |
| 2051 | contains: true, |
| 2052 | }, |
| 2053 | } |
| 2054 | |
| 2055 | for _, test := range tests { |
| 2056 | if test.contains { |
| 2057 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, cliArgContainsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/cliArgContains().(test.name, test.args)) |
| 2058 | } else { |
| 2059 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/False().(t, cliArgContainsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/cliArgContains().(test.name, test.args)) |
| 2060 | } |
| 2061 | } |
| 2062 | } |
| 2063 | |
| 2064 | func TestCommandHelpSuggestscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestCommandHelpSuggest().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 2065 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 2066 | Suggestscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Suggest.: true, |
| 2067 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 2068 | { |
| 2069 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "putz", |
| 2070 | }, |
| 2071 | }, |
| 2072 | } |
| 2073 | |
| 2074 | cmd.setupDefaultsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#setupDefaults().([]string{"foo"}) |
| 2075 | |
| 2076 | err := ShowCommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ShowCommandHelp.(contextscip-go gomod github.com/golang/go/src go1.22 context/.Backgroundscip-go gomod github.com/golang/go/src go1.22 context/Background().(), cmd, "put") |
| 2077 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.ErrorContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/ErrorContains().(t, err, "No help topic for 'put'. putz") |
| 2078 | } |
| 2079 | |
| 2080 | func TestWrapLinescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestWrapLine().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 2081 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, " ", wrapLinescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/wrapLine().(" ", 0, 3, " ")) |
| 2082 | } |
| 2083 | |
| 2084 | func TestPrintHelpCustomTemplateErrorscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestPrintHelpCustomTemplateError().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 2085 | tmpls := []*string{ |
| 2086 | &helpNameTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/helpNameTemplate., |
| 2087 | &argsTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/argsTemplate., |
| 2088 | &usageTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/usageTemplate., |
| 2089 | &descriptionTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/descriptionTemplate., |
| 2090 | &visibleCommandTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/visibleCommandTemplate., |
| 2091 | ©rightTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/copyrightTemplate., |
| 2092 | &versionTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/versionTemplate., |
| 2093 | &visibleFlagCategoryTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/visibleFlagCategoryTemplate., |
| 2094 | &visibleFlagTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/visibleFlagTemplate., |
| 2095 | &visiblePersistentFlagTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/visiblePersistentFlagTemplate., |
| 2096 | &visibleFlagCategoryTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/visibleFlagCategoryTemplate., |
| 2097 | &authorsTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/authorsTemplate., |
| 2098 | &visibleCommandCategoryTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/visibleCommandCategoryTemplate., |
| 2099 | } |
| 2100 | |
| 2101 | oldErrWriter := ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ErrWriter. |
| 2102 | defer func() { ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ErrWriter. = oldErrWriter }() |
| 2103 | |
| 2104 | t.Setenvscip-go gomod github.com/golang/go/src go1.22 testing/T#Setenv().("CLI_TEMPLATE_ERROR_DEBUG", "true") |
| 2105 | |
| 2106 | for _, tmpl := range tmpls { |
| 2107 | oldtmpl := *tmpl |
| 2108 | // safety mechanism in case something fails |
| 2109 | defer func(stmpl *string) { *stmpl = oldtmpl }(tmpl) |
| 2110 | |
| 2111 | errBuf := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 2112 | ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ErrWriter. = errBuf |
| 2113 | buf := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 2114 | |
| 2115 | *tmpl = "{{junk" |
| 2116 | DefaultPrintHelpCustomscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/DefaultPrintHelpCustom().(buf, "", "", nil) |
| 2117 | |
| 2118 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, errBuf.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), "CLI TEMPLATE ERROR") |
| 2119 | |
| 2120 | // reset template back. |
| 2121 | *tmpl = oldtmpl |
| 2122 | } |
| 2123 | } |
| 2124 | |
| 2125 | func TestCustomUsageCommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestCustomUsageCommandHelp().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 2126 | old := UsageCommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/UsageCommandHelp. |
| 2127 | defer func() { UsageCommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/UsageCommandHelp. = old }() |
| 2128 | |
| 2129 | UsageCommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/UsageCommandHelp. = "Custom usage help command" |
| 2130 | |
| 2131 | out := &bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#{} |
| 2132 | cmd := &Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 2133 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "app", |
| 2134 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 2135 | { |
| 2136 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "cmd", |
| 2137 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "subcmd"}}, |
| 2138 | }, |
| 2139 | }, |
| 2140 | Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer.: out, |
| 2141 | ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ErrWriter.: out, |
| 2142 | } |
| 2143 | |
| 2144 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t), []string{"app", "help"}) |
| 2145 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, out.Stringscip-go gomod github.com/golang/go/src go1.22 bytes/Buffer#String().(), UsageCommandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/UsageCommandHelp.) |
| 2146 | } |