Ecosyste.ms: Packages

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

Top 5.4% on proxy.golang.org
Top 1.9% dependent packages on proxy.golang.org
Top 2.3% dependent repos on proxy.golang.org

proxy.golang.org : github.com/posener/cmd

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.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/posener/cmd
Keywords: cmd, command, flag, go, golang, sub-command, subcommands
License: Apache-2.0
Latest release: over 3 years ago
First release: over 4 years ago
Namespace: github.com/posener
Dependent packages: 8
Dependent repositories: 5
Stars: 35 on GitHub
Forks: 2 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 22 days ago

    Loading...
    Readme
    Loading...