#arguments #parser #args

simple--args

A small library for parsing arguments in Rust

3 stable releases

1.1.1 Sep 16, 2022
1.0.0 Sep 16, 2022

#40 in #args

Download history 1/week @ 2024-02-14 12/week @ 2024-02-21 21/week @ 2024-02-28 13/week @ 2024-03-06 20/week @ 2024-03-13 14/week @ 2024-03-27 19/week @ 2024-04-03

63 downloads per month

MIT license

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:

  1. Commands (e.g. ./myprogram test)
  2. Flags (e.g. -y -myflag /anotherflag)
  3. 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)

No runtime deps