3 stable releases
1.1.1 | Sep 16, 2022 |
---|---|
1.0.0 | Sep 16, 2022 |
#43 in #args
4KB
Simple Args
A small library for parsing arguments in Rust
📝Docs
simpleargs::SimpleArgs
fn new(args: Vec<String>) -> SimpleArgs
Creates a new instance using the provided arguments.
fn parse(&self) -> (Vec<String>, Vec<String>, HashMap<String, String>)
Parses the arguments. Returns a tuple with:
- Commands (e.g.
./myprogram test
) - Flags (e.g.
-y -myflag /anotherflag
) - Options (e.g.
--my-message "Hello world!"
)
Prefixes like "-", "/" or "--" are not included in the output.
🗒️Examples
Try it out:
cargo build --lib --example [name of example]
./target/debug/examples/[name of example](.exe)