github.com/posener/cmd (go): Package cmd is a minimalistic library that enables easy sub commands with the standard `flag` library.  This library extends the standard library `flag` package to support sub commands and more features in a minimalistic and idiomatic API.  Features:  - [x] Sub commands.  - [x] Automatic bash completion.  - [x] Flag values definition and check.  - [x] Explicit positional arguments definition.  - [x] Automatic usage text.  Define a root command object using the `New` function. This object exposes the standard library's `flag.FlagSet` API, which enables adding flags in the standard way. Additionally, this object exposes the `SubCommand` method, which returns another command object. This objects also exposing the same API, enabling definition of flags and nested sub commands. The root object then have to be called with the `Parse` method, similarly to the `flag.Parse` call.  * Minimalistic and `flag`-like.  * Any flag that is defined in the base command will be reflected in all of its sub commands.  * When user types the command, it starts from the command and sub commands, only then types the flags and then the positional arguments:  * When a command defines positional arguments, all its sub commands has these positional arguments and thus can't define their own positional arguments.  * When flag configuration is wrong, the program will panic.  Definition and usage of sub commands and sub commands flags.   In the cmd package, positional arguments should be explicitly defined. They are defined using the `Args` or `ArgsVar` methods.   An example of how to parse positional arguments using a custom function. It enables the advantage of using named variables such as `src` and `dst` as opposed to args[0] and args[1].   An example of defining int positional arguments.   An example of defining an exact number of positional arguments.   An example that shows how to use advanced configuration of flags and positional arguments using the predict package.
Keywords: cmd|command|flag|go|golang|sub-command|subcommands