rargsxd

Crates.iorargsxd
lib.rsrargsxd
version0.2.6
sourcesrc
created_at2021-02-14 17:41:51.440871
updated_at2022-08-29 03:04:07.023255
descriptionSmall and simple argument parsing crate.
homepage
repositoryhttps://codeberg.org/BubbyRoosh/rargsxd
max_upload_size
id355143
size13,573
BubbyRoosh (BubbyRoosh1)

documentation

README

Example:

let mut args = ArgParser::new("rargsxd_example");
args.info("A test example for rargsxd")
    .author("BubbyRoosh")
    .version("0.1.0")
    .copyright("Copyright (C) 2021 BubbyRoosh")
    // All instances of {name} are replaced with the name of the program.
    .usage("{name} [arguments] [other ...]")
    .args(vec!(
    	Arg::bool("test", false)
    	    .short('t')
    	    .help("Test boolean argument"),
    	Arg::str("long", "")
    	    .long("long-argument")
    	    .help("Long argument test"),
    )).parse();

println!("{}", args.get_bool("test"));
println!("{}", args.get_str("long"));
println!("{:?}", args.extra);

Assuming the args passed are: -t --long-argument word another word

It would output:

word
true
["another", "word"]
Commit count: 0

cargo fmt