An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 8.2% on proxy.golang.org

proxy.golang.org : github.com/mark-summerfield/clop

Package clop “gee arg” provides yet another Go command line argument parser. clop can handle flags, single argument options, multiple argument options, and positional arguments. A flag is either present or absent. Examples: If the flag is present, the option's value is true; otherwise it is false. Flags support short and long names. For example, a flag name of "version" can be set with `--version` or `-v`. If you don't want a short name, or want a different one (e.g., `-V`), use [Option.SetShortName]. If you want the user to be able to optionally specify how verbose to be then use an Int value option: see Parser.Int. Multiple flags can be grouped together if their short names are used, e.g., given flags `-v`, `-x`, and `-c`, they can be set individually, or together, i.e., `-v -x -c` or `-vxc`. The last option in such a group may be a single- or multi-value option. For example, if option `o` takes a string argument, we could write any of these: And if we are happy with `-o`'s default value, we can use these: All of which set the `v`, `x`, and `c` flags as before and set the `-o` option to its default value. A single value option is either present—either with a value or without (in which case its default is used)—or absent, in which case its default is its value. Examples: If the option is absent, the option's value is the default that was set. If the option is present, the option's value is the default if no value is given, otherwise the given value. If you need to distinguish between whether a value was given at all (i.e., between the first two examples, assuming the default was set to 1), then use [Option.Given]. Here, verbose == 0 (since we started at 0 and checked whether it was given and it wasn't) Here, verbose == 1 (since it was given with no value, but due to AllowImplicit, the default was used for its value) Here, verbose == 2 (as given) TODO IntInRange eg + test TODO Real eg + test + note RealInRange TODO Choice eg + test TODO Str eg + test TODO Strs eg + test TODO Ints eg + test TODO Reals eg + test If some post-parsing validation finds invalid data it is possible to treat it as a parser error by calling Parser.OnError with a message string. This is a contradiction in terms, but if we really want to require an option then handle it like this:

Registry - Source - Documentation - JSON - codemeta.json
purl: pkg:golang/github.com/mark-summerfield/clop
License: Apache-2.0
Latest release: about 2 years ago
First release: about 3 years ago
Namespace: github.com/mark-summerfield
Last synced: 11 months ago

    Loading...
    Readme
    Loading...