Expand description
§badargs
A fully type-safe argument parser without any proc macros!
Declare your arguments with structs. You probably want to use the macro for that
use badargs::arg;
arg!(Force: "force", 'f' -> bool);
arg!(OutFile: "output", 'o' -> String);
The recommended way to use badargs
is by invoking the macro badargs!
use badargs::arg;
arg!(Force: "force", 'f' -> bool);
arg!(OutFile: "output", 'o' -> String);
let args = badargs::badargs!(Force, OutFile);
You can also invoke the badargs()
function directly
Getting the values is done using the BadArgs::get
function
use badargs::arg;
arg!(Force: "force", 'f' -> bool);
arg!(OutFile: "output", 'o' -> String);
let args = badargs::badargs!(Force, OutFile);
let force: Option<&bool> = args.get::<Force>();
let out_file = args.get::<OutFile>();
Macros§
Structs§
- BadArgs
- The struct containing parsed argument information
Enums§
- Schema
Error - Invalid schema
Traits§
- CliArg
- Implemented by a user provided type that contains all info for a single command line argument
- CliReturn
Value - A type that could be parsed from command line arguments
Functions§
- badargs
- Parses the command line arguments based on the provided schema S