github.com/cavaliergopher/xflags (go): Package xflags implements command-line flag parsing and is a compatible alternative to Go's flag package. This package provides higher-order features such as subcommands, positional arguments, required arguments, validation, support for environment variables and others.  Package xflags aims to make composing large, full-featured command line tools as simple and clean as possible. The Builder pattern is employed with method chaining to configure commands and flags declaratively with error checking.  For compatibility, flag.FlagSets may be imported with CommandBuilder.FlagSet.  Every xflags program must define a top-level command using xflags.NewCommand:  You can import all global flags defined using Go's flag library with CommandBuilder.FlagSet.  You can bind a flag to a variable using the Var functions.  Or you can create custom flags that satisfy the Value interface (with pointer receivers) and couple them to a flag parsing by  For such flags, the default value is just the initial value of the variable.  A handler may be defined for your command by  Flag parsing will stop after "--" only if a command sets WithTerminator. All arguments following the terminator will be passed to the command handler.  You can define subcommands by  After all flags are defined, call  to parse the command line into the defined flags and call the handler associated with the command or any if its subcommands if specified in os.Args.  Flags may then be used directly.  In addition to positional arguments, the following forms are permitted:  The noted forms are not permitted for boolean flags because of the meaning of the command  where * is a Unix shell wildcard, will change if there is a file called 0, false, etc.
Keywords: cli|command-line|go|golang