@ -1,4 +1,7 @@
### Arguments
---
tags:
- v1
You can lookup arguments by calling the `Args` function on `cli.Context`, e.g.:
@ -1,3 +1,8 @@
You can enable completion commands by setting the `EnableBashCompletion`
flag on the `App` object. By default, this setting will only auto-complete to
show an app's subcommands, but you can write your own completion methods for
Traditional use of options using their shortnames look like this:
```
Calling `App.Run` will not automatically call `os.Exit`, which means that by
default the exit code will "fall through" to being `0`. An explicit exit code
may be set by returning a non-nil error that fulfills `cli.ExitCoder`, *or* a
Setting and querying flags is simple.
<!-- {
The default help flag (`-h/--help`) is defined as `cli.HelpFlag` and is checked
by the cli internals in order to print generated help text for the app, command,
or subcommand, and break execution.
Being a programmer can be a lonely job. Thankfully by the power of automation
that is not the case! Let's create a greeter app to fend off our demons of
loneliness!
For additional organization in apps that have many subcommands, you can
associate a category for each command to group them together in the help
output.
Subcommands can be defined for a more git-like command line app.
### Version Flag
The default version flag (`-v/--version`) is defined as `cli.VersionFlag`, which
is checked by the cli internals in order to print the `App.Version` via
One of the philosophies behind cli is that an API should be playful and full of
discovery. So a cli app can be as little as one line of code in `main()`.
## Migrating to V2
There are a small set of breaking changes between v1 and v2.
Converting is relatively straightforward and typically takes less than
@ -1,3 +1,10 @@
- v2
search:
boost: 2
You can enable completion commands by setting the `EnableBashCompletion` flag on
the `App` object to `true`. By default, this setting will allow auto-completion
for an app's subcommands, but you can write your own completion methods for the
```sh-session
**Notice**: This is a contrived (functioning) example meant strictly for API
demonstration purposes. Use of one's imagination is encouraged.
output, e.g.:
To enable flag and command suggestions, set `app.Suggest = true`. If the suggest
feature is enabled, then the help output of the corresponding command will
provide an appropriate suggestion for the provided flag or subcommand if
Using the timestamp flag is simple. Please refer to
[`time.Parse`](https://golang.org/pkg/time/#example_Parse) to get possible
formats.
`cli.VersionPrinter` and break execution.
There are a small set of breaking changes between v1 and v2. Converting is
relatively straightforward and typically takes less than an hour. Specific steps
are included in [Migration Guide: v1 to v2](../migrate-v1-to-v2.md). Also see