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

github.com/docopt/docopt-go

Package docopt parses command-line arguments based on a help message. Given a conventional command-line help message, docopt processes the arguments. See https://github.com/docopt/docopt#help-message-format for a description of the help message format. This package exposes three different APIs, depending on the level of control required. The first, simplest way to parse your docopt usage is to just call: This will use os.Args[1:] as the argv slice, and use the default parser options. If you want to provide your own version string and args, then use: If the last parameter (version) is a non-empty string, it will be printed when --version is given in the argv slice. Finally, we can instantiate our own docopt.Parser which gives us control over how things like help messages are printed and whether to exit after displaying usage messages, etc. In particular, setting your own custom HelpHandler function makes unit testing your own docs with example command line invocations much more enjoyable. All three of these return a map of option names to the values parsed from argv, and an error or nil. You can get the values using the helpers, or just treat it as a regular map: Additionally, you can `Bind` these to a struct, assigning option values to the exported fields of that struct, all at once.

Ecosystem
proxy.golang.org
Latest Release
v0.0.0-20180111231733-ee0de3bc6815
about 8 years ago
Versions
3
Dependent Packages
650
Dependent Repos
39,765
Links
Registry proxy.golang.org
Source Repository
Docs Documentation
JSON API View JSON
CodeMeta codemeta.json
Package Details
PURL pkg:golang/github.com/docopt/docopt-go
spec
License MIT
Namespace github.com/docopt
First Release over 11 years ago
Last Synced about 8 hours ago
Repository
Stars 1,431 on GitHub
Forks 109 on GitHub
Docker Dependents 223
Docker Downloads 289,123,328
Commits 84
Committers 6
Avg per Author 14.0
DDS 0.452
Rankings on proxy.golang.org
Overall Top 0.9%
Dependent packages Top 0.2%
Dependent repos Top 0.1%
Forks Top 2.5%
Docker downloads Top 0.2%