| 1 | package cli_testscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.22 context/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.22 fmt/" |
| 6 | "net/mailscip-go gomod github.com/golang/go/src go1.22 `net/mail`/" |
| 7 | "osscip-go gomod github.com/golang/go/src go1.22 os/" |
| 8 | "timescip-go gomod github.com/golang/go/src go1.22 time/" |
| 9 | |
| 10 | // Alias the package import to make the examples runnable on pkg.go.dev. |
| 11 | // |
| 12 | // See issue #1811. |
| 13 | cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ "github.com/urfave/cli/v3scip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/" |
| 14 | ) |
| 15 | |
| 16 | func ExampleCommand_Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Run().() { |
| 17 | // Declare a command |
| 18 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 19 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "greet", |
| 20 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 21 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.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.: "name", Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Value.: "pat", Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Usage.: "a name to say"}, |
| 22 | }, |
| 23 | 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 *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 24 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printfscip-go gomod github.com/golang/go/src go1.22 fmt/Printf().("Hello %[1]v\n", cmd.Stringscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#String().("name")) |
| 25 | return nil |
| 26 | }, |
| 27 | Authorsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Authors.: []any{ |
| 28 | &mailscip-go gomod github.com/golang/go/src go1.22 `net/mail`/.Addressscip-go gomod github.com/golang/go/src go1.22 `net/mail`/Address#{Namescip-go gomod github.com/golang/go/src go1.22 `net/mail`/Address#Name.: "Oliver Allen", Addressscip-go gomod github.com/golang/go/src go1.22 `net/mail`/Address#Address.: "[email protected]"}, |
| 29 | "[email protected]", |
| 30 | }, |
| 31 | Versionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Version.: "v0.13.12", |
| 32 | } |
| 33 | |
| 34 | // Simulate the command line arguments |
| 35 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = []string{"greet", "--name", "Jeremy"} |
| 36 | |
| 37 | if err := 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().(), osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args.); err != nil { |
| 38 | // do something with unhandled errors |
| 39 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.22 fmt/Fprintf().(osscip-go gomod github.com/golang/go/src go1.22 os/.Stderrscip-go gomod github.com/golang/go/src go1.22 os/Stderr., "Unhandled error: %[1]v\n", err) |
| 40 | osscip-go gomod github.com/golang/go/src go1.22 os/.Exitscip-go gomod github.com/golang/go/src go1.22 os/Exit().(86) |
| 41 | } |
| 42 | // Output: |
| 43 | // Hello Jeremy |
| 44 | } |
| 45 | |
| 46 | func ExampleCommand_Run_subcommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Run_subcommand().() { |
| 47 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 48 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "say", |
| 49 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 50 | { |
| 51 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "hello", |
| 52 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"hi"}, |
| 53 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "use it to see a description", |
| 54 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "This is how we describe hello the function", |
| 55 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 56 | { |
| 57 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "english", |
| 58 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"en"}, |
| 59 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "sends a greeting in english", |
| 60 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "greets someone in english", |
| 61 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 62 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 63 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "name", |
| 64 | Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Value.: "Bob", |
| 65 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Usage.: "Name of the person to greet", |
| 66 | }, |
| 67 | }, |
| 68 | 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 *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 69 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.22 fmt/Println().("Hello,", cmd.Stringscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#String().("name")) |
| 70 | return nil |
| 71 | }, |
| 72 | }, |
| 73 | }, |
| 74 | }, |
| 75 | }, |
| 76 | } |
| 77 | |
| 78 | ctx, cancel := contextscip-go gomod github.com/golang/go/src go1.22 context/.WithTimeoutscip-go gomod github.com/golang/go/src go1.22 context/WithTimeout().(contextscip-go gomod github.com/golang/go/src go1.22 context/.Backgroundscip-go gomod github.com/golang/go/src go1.22 context/Background().(), 100*timescip-go gomod github.com/golang/go/src go1.22 time/.Millisecondscip-go gomod github.com/golang/go/src go1.22 time/Millisecond.) |
| 79 | defer cancel() |
| 80 | |
| 81 | // Simulate the command line arguments |
| 82 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = []string{"say", "hi", "english", "--name", "Jeremy"} |
| 83 | |
| 84 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(ctx, osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args.) |
| 85 | // Output: |
| 86 | // Hello, Jeremy |
| 87 | } |
| 88 | |
| 89 | func ExampleCommand_Run_appHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Run_appHelp().() { |
| 90 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 91 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "greet", |
| 92 | Versionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Version.: "0.1.0", |
| 93 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "This is how we describe greet the app", |
| 94 | Authorsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Authors.: []any{ |
| 95 | &mailscip-go gomod github.com/golang/go/src go1.22 `net/mail`/.Addressscip-go gomod github.com/golang/go/src go1.22 `net/mail`/Address#{Namescip-go gomod github.com/golang/go/src go1.22 `net/mail`/Address#Name.: "Harrison", Addressscip-go gomod github.com/golang/go/src go1.22 `net/mail`/Address#Address.: "[email protected]"}, |
| 96 | "Oliver Allen <[email protected]>", |
| 97 | }, |
| 98 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 99 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.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.: "name", Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Value.: "bob", Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Usage.: "a name to say"}, |
| 100 | }, |
| 101 | Argumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Arguments.: cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.AnyArgumentsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/AnyArguments., |
| 102 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 103 | { |
| 104 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "describeit", |
| 105 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"d"}, |
| 106 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "use it to see a description", |
| 107 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "This is how we describe describeit the function", |
| 108 | ArgsUsagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ArgsUsage.: "[arguments...]", |
| 109 | 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#, *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 110 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printfscip-go gomod github.com/golang/go/src go1.22 fmt/Printf().("i like to describe things") |
| 111 | return nil |
| 112 | }, |
| 113 | }, |
| 114 | }, |
| 115 | } |
| 116 | |
| 117 | ctx, cancel := contextscip-go gomod github.com/golang/go/src go1.22 context/.WithTimeoutscip-go gomod github.com/golang/go/src go1.22 context/WithTimeout().(contextscip-go gomod github.com/golang/go/src go1.22 context/.Backgroundscip-go gomod github.com/golang/go/src go1.22 context/Background().(), 100*timescip-go gomod github.com/golang/go/src go1.22 time/.Millisecondscip-go gomod github.com/golang/go/src go1.22 time/Millisecond.) |
| 118 | defer cancel() |
| 119 | |
| 120 | // Simulate the command line arguments |
| 121 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = []string{"greet", "help"} |
| 122 | |
| 123 | _ = cmd.Runscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Run().(ctx, osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args.) |
| 124 | // Output: |
| 125 | // NAME: |
| 126 | // greet - A new cli application |
| 127 | // |
| 128 | // USAGE: |
| 129 | // greet [global options] [command [command options]] [arguments...] |
| 130 | // |
| 131 | // VERSION: |
| 132 | // 0.1.0 |
| 133 | // |
| 134 | // DESCRIPTION: |
| 135 | // This is how we describe greet the app |
| 136 | // |
| 137 | // AUTHORS: |
| 138 | // "Harrison" <[email protected]> |
| 139 | // Oliver Allen <[email protected]> |
| 140 | // |
| 141 | // COMMANDS: |
| 142 | // describeit, d use it to see a description |
| 143 | // help, h Shows a list of commands or help for one command |
| 144 | // |
| 145 | // GLOBAL OPTIONS: |
| 146 | // --name string a name to say (default: "bob") |
| 147 | // --help, -h show help |
| 148 | // --version, -v print the version |
| 149 | } |
| 150 | |
| 151 | func ExampleCommand_Run_commandHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Run_commandHelp().() { |
| 152 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 153 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "greet", |
| 154 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 155 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.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.: "name", Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Value.: "pat", Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Usage.: "a name to say"}, |
| 156 | }, |
| 157 | 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 *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 158 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.22 fmt/Fprintf().(cmd.Rootscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Root().().Writerscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Writer., "hello to %[1]q\n", cmd.Stringscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#String().("name")) |
| 159 | return nil |
| 160 | }, |
| 161 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 162 | { |
| 163 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "describeit", |
| 164 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"d"}, |
| 165 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "use it to see a description", |
| 166 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "This is how we describe describeit the function", |
| 167 | ArgsUsagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ArgsUsage.: "[arguments...]", |
| 168 | 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#, *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 169 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.22 fmt/Println().("i like to describe things") |
| 170 | return nil |
| 171 | }, |
| 172 | }, |
| 173 | }, |
| 174 | } |
| 175 | |
| 176 | // Simulate the command line arguments |
| 177 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = []string{"greet", "h", "describeit"} |
| 178 | |
| 179 | _ = 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().(), osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args.) |
| 180 | // Output: |
| 181 | // NAME: |
| 182 | // greet describeit - use it to see a description |
| 183 | // |
| 184 | // USAGE: |
| 185 | // greet describeit [options] [arguments...] |
| 186 | // |
| 187 | // DESCRIPTION: |
| 188 | // This is how we describe describeit the function |
| 189 | // |
| 190 | // OPTIONS: |
| 191 | // --help, -h show help |
| 192 | // |
| 193 | // GLOBAL OPTIONS: |
| 194 | // --name string a name to say (default: "pat") |
| 195 | } |
| 196 | |
| 197 | func ExampleCommand_Run_noActionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Run_noAction().() { |
| 198 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.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.: "greet"} |
| 199 | |
| 200 | // Simulate the command line arguments |
| 201 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = []string{"greet"} |
| 202 | |
| 203 | _ = 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().(), osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args.) |
| 204 | // Output: |
| 205 | // NAME: |
| 206 | // greet - A new cli application |
| 207 | // |
| 208 | // USAGE: |
| 209 | // greet [global options] |
| 210 | // |
| 211 | // GLOBAL OPTIONS: |
| 212 | // --help, -h show help |
| 213 | } |
| 214 | |
| 215 | func ExampleCommand_Run_subcommandNoActionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Run_subcommandNoAction().() { |
| 216 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 217 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "greet", |
| 218 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 219 | { |
| 220 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "describeit", |
| 221 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"d"}, |
| 222 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "use it to see a description", |
| 223 | ArgsUsagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ArgsUsage.: "[arguments...]", |
| 224 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "This is how we describe describeit the function", |
| 225 | }, |
| 226 | }, |
| 227 | } |
| 228 | |
| 229 | // Simulate the command line arguments |
| 230 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = []string{"greet", "describeit"} |
| 231 | |
| 232 | _ = 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().(), osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args.) |
| 233 | // Output: |
| 234 | // NAME: |
| 235 | // greet describeit - use it to see a description |
| 236 | // |
| 237 | // USAGE: |
| 238 | // greet describeit [options] [arguments...] |
| 239 | // |
| 240 | // DESCRIPTION: |
| 241 | // This is how we describe describeit the function |
| 242 | // |
| 243 | // OPTIONS: |
| 244 | // --help, -h show help |
| 245 | } |
| 246 | |
| 247 | func ExampleCommand_Run_shellComplete_bash_withShortFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Run_shellComplete_bash_withShortFlag().() { |
| 248 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 249 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "greet", |
| 250 | EnableShellCompletionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#EnableShellCompletion.: true, |
| 251 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 252 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Int64Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64Flag#{ |
| 253 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "other", |
| 254 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"o"}, |
| 255 | }, |
| 256 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 257 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "xyz", |
| 258 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"x"}, |
| 259 | }, |
| 260 | }, |
| 261 | } |
| 262 | |
| 263 | // Simulate a bash environment and command line arguments |
| 264 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = []string{"greet", "-", "--generate-shell-completion"} |
| 265 | |
| 266 | _ = 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().(), osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args.) |
| 267 | // Output: |
| 268 | // --other |
| 269 | // --xyz |
| 270 | // --help:show help |
| 271 | } |
| 272 | |
| 273 | func ExampleCommand_Run_shellComplete_bash_withLongFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Run_shellComplete_bash_withLongFlag().() { |
| 274 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 275 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "greet", |
| 276 | EnableShellCompletionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#EnableShellCompletion.: true, |
| 277 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 278 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Int64Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64Flag#{ |
| 279 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "other", |
| 280 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"o"}, |
| 281 | }, |
| 282 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 283 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "xyz", |
| 284 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"x"}, |
| 285 | }, |
| 286 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 287 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "some-flag,s", |
| 288 | }, |
| 289 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 290 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "similar-flag", |
| 291 | }, |
| 292 | }, |
| 293 | } |
| 294 | |
| 295 | // Simulate a bash environment and command line arguments |
| 296 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = []string{"greet", "--s", "--generate-shell-completion"} |
| 297 | |
| 298 | _ = 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().(), osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args.) |
| 299 | // Output: |
| 300 | // --some-flag |
| 301 | // --similar-flag |
| 302 | } |
| 303 | |
| 304 | func ExampleCommand_Run_shellComplete_bash_withMultipleLongFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Run_shellComplete_bash_withMultipleLongFlag().() { |
| 305 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 306 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "greet", |
| 307 | EnableShellCompletionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#EnableShellCompletion.: true, |
| 308 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 309 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Int64Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64Flag#{ |
| 310 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "int-flag", |
| 311 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"i"}, |
| 312 | }, |
| 313 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 314 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "string", |
| 315 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Aliases.: []string{"s"}, |
| 316 | }, |
| 317 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 318 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "string-flag-2", |
| 319 | }, |
| 320 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 321 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "similar-flag", |
| 322 | }, |
| 323 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.StringFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringFlag#{ |
| 324 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "some-flag", |
| 325 | }, |
| 326 | }, |
| 327 | } |
| 328 | |
| 329 | // Simulate a bash environment and command line arguments |
| 330 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = []string{"greet", "--st", "--generate-shell-completion"} |
| 331 | |
| 332 | _ = 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().(), osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args.) |
| 333 | // Output: |
| 334 | // --string |
| 335 | // --string-flag-2 |
| 336 | } |
| 337 | |
| 338 | func ExampleCommand_Run_shellComplete_bashscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Run_shellComplete_bash().() { |
| 339 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 340 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "greet", |
| 341 | EnableShellCompletionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#EnableShellCompletion.: true, |
| 342 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 343 | { |
| 344 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "describeit", |
| 345 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"d"}, |
| 346 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "use it to see a description", |
| 347 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "This is how we describe describeit the function", |
| 348 | 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#, *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 349 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printfscip-go gomod github.com/golang/go/src go1.22 fmt/Printf().("i like to describe things") |
| 350 | return nil |
| 351 | }, |
| 352 | }, { |
| 353 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "next", |
| 354 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "next example", |
| 355 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "more stuff to see when generating shell completion", |
| 356 | 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#, *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 357 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printfscip-go gomod github.com/golang/go/src go1.22 fmt/Printf().("the next example") |
| 358 | return nil |
| 359 | }, |
| 360 | }, |
| 361 | }, |
| 362 | } |
| 363 | |
| 364 | // Simulate a bash environment and command line arguments |
| 365 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = []string{"greet", "--generate-shell-completion"} |
| 366 | |
| 367 | _ = 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().(), osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args.) |
| 368 | // Output: |
| 369 | // describeit:use it to see a description |
| 370 | // next:next example |
| 371 | // help:Shows a list of commands or help for one command |
| 372 | } |
| 373 | |
| 374 | func ExampleCommand_Run_shellComplete_zshscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Run_shellComplete_zsh().() { |
| 375 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 376 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "greet", |
| 377 | EnableShellCompletionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#EnableShellCompletion.: true, |
| 378 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 379 | { |
| 380 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "describeit", |
| 381 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"d"}, |
| 382 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "use it to see a description", |
| 383 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "This is how we describe describeit the function", |
| 384 | 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#, *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 385 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printfscip-go gomod github.com/golang/go/src go1.22 fmt/Printf().("i like to describe things") |
| 386 | return nil |
| 387 | }, |
| 388 | }, { |
| 389 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "next", |
| 390 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "next example", |
| 391 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "more stuff to see when generating bash completion", |
| 392 | 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#, *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 393 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printfscip-go gomod github.com/golang/go/src go1.22 fmt/Printf().("the next example") |
| 394 | return nil |
| 395 | }, |
| 396 | }, |
| 397 | }, |
| 398 | } |
| 399 | |
| 400 | // Simulate a zsh environment and command line arguments |
| 401 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = []string{"greet", "--generate-shell-completion"} |
| 402 | |
| 403 | _ = 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().(), osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args.) |
| 404 | // Output: |
| 405 | // describeit:use it to see a description |
| 406 | // next:next example |
| 407 | // help:Shows a list of commands or help for one command |
| 408 | } |
| 409 | |
| 410 | func ExampleCommand_Run_shellComplete_fishscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Run_shellComplete_fish().() { |
| 411 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 412 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "greet", |
| 413 | EnableShellCompletionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#EnableShellCompletion.: true, |
| 414 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 415 | { |
| 416 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "describeit", |
| 417 | Aliasesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Aliases.: []string{"d"}, |
| 418 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "use it to see a description", |
| 419 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "This is how we describe describeit the function", |
| 420 | 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#, *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 421 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printfscip-go gomod github.com/golang/go/src go1.22 fmt/Printf().("i like to describe things") |
| 422 | return nil |
| 423 | }, |
| 424 | }, { |
| 425 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "next", |
| 426 | Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Usage.: "next example", |
| 427 | Descriptionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Description.: "more stuff to see when generating bash completion", |
| 428 | 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#, *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 429 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printfscip-go gomod github.com/golang/go/src go1.22 fmt/Printf().("the next example") |
| 430 | return nil |
| 431 | }, |
| 432 | }, |
| 433 | }, |
| 434 | } |
| 435 | |
| 436 | // Simulate a fish environment and command line arguments |
| 437 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = []string{"greet", "--generate-shell-completion"} |
| 438 | |
| 439 | _ = 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().(), osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args.) |
| 440 | // Output: |
| 441 | // describeit:use it to see a description |
| 442 | // next:next example |
| 443 | // help:Shows a list of commands or help for one command |
| 444 | } |
| 445 | |
| 446 | func ExampleCommand_Run_sliceValuesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Run_sliceValues().() { |
| 447 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 448 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "multi_values", |
| 449 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 450 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.StringSliceFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringSliceFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "stringSlice"}, |
| 451 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.FloatSliceFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FloatSliceFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "float64Slice"}, |
| 452 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Int64SliceFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Int64SliceFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "intSlice"}, |
| 453 | }, |
| 454 | HideHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelp.: true, |
| 455 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(ctx contextscip-go gomod github.com/golang/go/src go1.22 context/.Contextscip-go gomod github.com/golang/go/src go1.22 context/Context#, cmd *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 456 | for i, v := range cmd.FlagNamesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#FlagNames().() { |
| 457 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printfscip-go gomod github.com/golang/go/src go1.22 fmt/Printf().("%d-%s %#v\n", i, v, cmd.Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Value().(v)) |
| 458 | } |
| 459 | err := ctx.Errscip-go gomod github.com/golang/go/src go1.22 context/Context#Err().() |
| 460 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.22 fmt/Println().("error:", err) |
| 461 | return err |
| 462 | }, |
| 463 | } |
| 464 | |
| 465 | // Simulate command line arguments |
| 466 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = []string{ |
| 467 | "multi_values", |
| 468 | "--stringSlice", "parsed1,parsed2", "--stringSlice", "parsed3,parsed4", |
| 469 | "--float64Slice", "13.3,14.4", "--float64Slice", "15.5,16.6", |
| 470 | "--intSlice", "13,14", "--intSlice", "15,16", |
| 471 | } |
| 472 | |
| 473 | _ = 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().(), osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args.) |
| 474 | // Output: |
| 475 | // 0-stringSlice []string{"parsed1", "parsed2", "parsed3", "parsed4"} |
| 476 | // 1-float64Slice []float64{13.3, 14.4, 15.5, 16.6} |
| 477 | // 2-intSlice []int64{13, 14, 15, 16} |
| 478 | // error: <nil> |
| 479 | } |
| 480 | |
| 481 | func ExampleCommand_Run_mapValuesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Run_mapValues().() { |
| 482 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 483 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "multi_values", |
| 484 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 485 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.StringMapFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/StringMapFlag#{Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Name.: "stringMap"}, |
| 486 | }, |
| 487 | HideHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelp.: true, |
| 488 | Actionscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Action.: func(ctx contextscip-go gomod github.com/golang/go/src go1.22 context/.Contextscip-go gomod github.com/golang/go/src go1.22 context/Context#, cmd *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 489 | for i, v := range cmd.FlagNamesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#FlagNames().() { |
| 490 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printfscip-go gomod github.com/golang/go/src go1.22 fmt/Printf().("%d-%s %#v\n", i, v, cmd.StringMapscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#StringMap().(v)) |
| 491 | } |
| 492 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printfscip-go gomod github.com/golang/go/src go1.22 fmt/Printf().("notfound %#v\n", cmd.StringMapscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#StringMap().("notfound")) |
| 493 | err := ctx.Errscip-go gomod github.com/golang/go/src go1.22 context/Context#Err().() |
| 494 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.22 fmt/Println().("error:", err) |
| 495 | return err |
| 496 | }, |
| 497 | } |
| 498 | |
| 499 | // Simulate command line arguments |
| 500 | osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args. = []string{ |
| 501 | "multi_values", |
| 502 | "--stringMap", "parsed1=parsed two", "--stringMap", "parsed3=", |
| 503 | } |
| 504 | |
| 505 | _ = 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().(), osscip-go gomod github.com/golang/go/src go1.22 os/.Argsscip-go gomod github.com/golang/go/src go1.22 os/Args.) |
| 506 | // Output: |
| 507 | // 0-stringMap map[string]string{"parsed1":"parsed two", "parsed3":""} |
| 508 | // notfound map[string]string(nil) |
| 509 | // error: <nil> |
| 510 | } |
| 511 | |
| 512 | func ExampleBoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleBoolWithInverseFlag().() { |
| 513 | flagWithInverse := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.BoolWithInverseFlagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#{ |
| 514 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Name.: "env", |
| 515 | } |
| 516 | |
| 517 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 518 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 519 | flagWithInverse, |
| 520 | }, |
| 521 | 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 *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 522 | if flagWithInverse.IsSetscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#IsSet().() { |
| 523 | if cmd.Boolscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Bool().("env") { |
| 524 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.22 fmt/Println().("env is set") |
| 525 | } else { |
| 526 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.22 fmt/Println().("no-env is set") |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | return nil |
| 531 | }, |
| 532 | } |
| 533 | |
| 534 | _ = 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{"prog", "--no-env"}) |
| 535 | |
| 536 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.22 fmt/Println().("flags:", len(flagWithInverse.Namesscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/BoolWithInverseFlag#Names().())) |
| 537 | |
| 538 | // Output: |
| 539 | // no-env is set |
| 540 | // flags: 2 |
| 541 | } |
| 542 | |
| 543 | func ExampleCommand_Suggestscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Suggest().() { |
| 544 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 545 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "greet", |
| 546 | ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ErrWriter.: osscip-go gomod github.com/golang/go/src go1.22 os/.Stdoutscip-go gomod github.com/golang/go/src go1.22 os/Stdout., |
| 547 | Suggestscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Suggest.: true, |
| 548 | HideHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelp.: false, |
| 549 | HideHelpCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelpCommand.: true, |
| 550 | CustomRootCommandHelpTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#CustomRootCommandHelpTemplate.: "(this space intentionally left blank)\n", |
| 551 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 552 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.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.: "name", Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Value.: "squirrel", Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Usage.: "a name to say"}, |
| 553 | }, |
| 554 | 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 *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 555 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printfscip-go gomod github.com/golang/go/src go1.22 fmt/Printf().("Hello %v\n", cmd.Stringscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#String().("name")) |
| 556 | return nil |
| 557 | }, |
| 558 | } |
| 559 | |
| 560 | if 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{"greet", "--nema", "chipmunk"}) == nil { |
| 561 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.22 fmt/Println().("Expected error") |
| 562 | } |
| 563 | // Output: |
| 564 | // Incorrect Usage: flag provided but not defined: -nema |
| 565 | // |
| 566 | // Did you mean "--name"? |
| 567 | // |
| 568 | // (this space intentionally left blank) |
| 569 | } |
| 570 | |
| 571 | func ExampleCommand_Suggest_commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3_test`/ExampleCommand_Suggest_command().() { |
| 572 | cmd := &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 573 | ErrWriterscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#ErrWriter.: osscip-go gomod github.com/golang/go/src go1.22 os/.Stdoutscip-go gomod github.com/golang/go/src go1.22 os/Stdout., |
| 574 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "greet", |
| 575 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 576 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.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.: "name", Valuescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Value.: "squirrel", Usagescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/FlagBase#Usage.: "a name to say"}, |
| 577 | }, |
| 578 | 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 *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 579 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printfscip-go gomod github.com/golang/go/src go1.22 fmt/Printf().("Hello %v\n", cmd.Stringscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#String().("name")) |
| 580 | return nil |
| 581 | }, |
| 582 | Commandsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Commands.: []*cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#{ |
| 583 | { |
| 584 | Namescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Name.: "neighbors", |
| 585 | HideHelpscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelp.: true, |
| 586 | HideHelpCommandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#HideHelpCommand.: true, |
| 587 | Suggestscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Suggest.: true, |
| 588 | CustomHelpTemplatescip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#CustomHelpTemplate.: "(this space intentionally left blank)\n", |
| 589 | Flagsscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Flags.: []cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Flagscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Flag#{ |
| 590 | &cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.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.: "smiling"}, |
| 591 | }, |
| 592 | 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 *cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/.Commandscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#) error { |
| 593 | if cmd.Boolscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/Command#Bool().("smiling") { |
| 594 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.22 fmt/Println().("😀") |
| 595 | } |
| 596 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.22 fmt/Println().("Hello, neighbors") |
| 597 | return nil |
| 598 | }, |
| 599 | }, |
| 600 | }, |
| 601 | } |
| 602 | |
| 603 | if 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{"greet", "neighbors", "--sliming"}) == nil { |
| 604 | fmtscip-go gomod github.com/golang/go/src go1.22 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.22 fmt/Println().("Expected error") |
| 605 | } |
| 606 | // Output: |
| 607 | // Incorrect Usage: flag provided but not defined: -sliming |
| 608 | // |
| 609 | // Did you mean "--smiling"? |
| 610 | } |