parse_argument-0.1.3 has been yanked.
parse_arguments_rs
Easy way to deal with parsing commandline arguments
Can be used with any type that implements FromStr (for parsing).
Use parse_argument()
function to find a value for a specified key (flag). Look at the examples for an idea of how to use it.
It works for arguments that look like this:
And to retrieve those values you would write:
// assuming you made an Setting enum that implemented FromStr trait
let _ = .unwrap.unwrap;
let _ = .unwrap.unwrap;
let _ = .unwrap.unwrap;
Run cargo doc --open
to see the documentation.
crates.io link
TODO
- the key nor the value can have any spaces because of the nature of
std::env::args
. I will try to fix it at some point. - the hashmap function clones strings which could be more efficient