adante
adante is a simple library that handles the logic of user defined types
in order to provide efficiency in parsing command line arguments.
At its core, adante simply provides an interface of which command line
arguments can be transformed into a collection of three types.
- Flags, which consist of:
- A flag key
- An optional
Stringvalue
- Actions
- Errors
This is achieved by implementing a simple, but widely versatile set of tools laid out by the library. Here are the steps to making your first parser!
1. Define an enum consisting of all the errors your program might run into.
This can be seperate from your application's general Error enum if you have one, or it can be the same.
// Highly advised
2. Imply the Error trait from the library.
use Error;
// Highly advised
3. Define an enum consisting of all of your flag and action keys.
4. Imply the ArgumentType trait from the library.
use ArgumentType;
And voila!
Now your parser is complete! By plugging std::env::args::collect() into
Arguments::parse(), you will get a working Arguments object!