:heavydollarsign: A very thin wrapper for command line arguments in Rust.
Cargo.toml
file.toml
[dependencies]
clioptions = { git = "https://github.com/stpettersens/clioptions.git" }
```rust extern crate clioptions; use clioptions::CliOptions;
fn main() { let cli = CliOptions::new("programname"); // "programname" is the fallback for argv[0]. let program = cli.getprogram(); let mut filename = String::new(); if cli.getnum() > 1 { for (i, a) in cli.getargs().iter().enumerate() { match a.trim() { "-h" | "--help" => displayusage(&program, 0), "-v" | "--version" => displayversion(), "-f" | "--file" => filename = cli.nextargument(i), // nextargument(i) gets the argument after i. _ => continue, } } } if(!filename.isempty()) { dosomethingwith_filename(&filename); } } ```