Crate arguments

source ·
Expand description

Parser for command-line arguments.

Example

// foo --no-bar --baz 42 --baz 69 --qux "Hello, world!"
let arguments = std::env::args();
let arguments = arguments::parse(arguments).unwrap();

assert_eq!(arguments.program, "foo");
assert_eq!(arguments.get::<bool>("bar").unwrap(), false);
assert_eq!(arguments.get::<usize>("baz").unwrap(), 69);
assert_eq!(arguments.get_all::<usize>("baz").unwrap(), &[42, 69]);
assert_eq!(arguments.get::<String>("qux").unwrap(), "Hello, world!");

Structs

Functions

  • Parse command-line arguments.

Type Definitions