6 releases
0.5.6 | Dec 13, 2020 |
---|---|
0.5.5 | Oct 20, 2020 |
0.5.4 | Aug 18, 2020 |
0.5.0 | Jun 10, 2020 |
#1095 in Command-line interface
47 downloads per month
Used in 2 crates
51KB
1.5K
SLoC
This command line parser is based on a C++ command line parser which is based on a C command line parser which in turn was inspired by the Python argparse module.
The basic use pattern for qargparser is:
- Create a context struct for storing parser output.
- Create one or more
Builder
. - Create
Spec
objects from theBuilder
objects by callingBuilder::build()
, passing a function for processing the option/argument. - Create a
Parser
object (Parser::from_env()
orParser::from_args()
) handing over the ownership of a parser context struct. - Add the
Spec
objects to the parser object usingParser::add()
. - Call the parser.
- At this point, if successful, the parser context should be populated
with data from the command line. Call
Parser::into_ctx()
to regain ownership of the context.
One of the minor goals of qargparser is to simplify reuse of option/argument specs between parsers.
ToDo
- Currently converts argument strings to UTF-8. Should support
OsStr(ing)
.
Dependencies
~240KB