Crate badargs[−][src]
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
Declare your arguments using this macro.
Structs
The struct containing parsed argument information
Enums
Invalid schema
Traits
Implemented by a user provided type that contains all info for a single command line argument
A type that could be parsed from command line arguments
Functions
Parses the command line arguments based on the provided schema S