Crates.io | rargsxd |
lib.rs | rargsxd |
version | 0.2.6 |
source | src |
created_at | 2021-02-14 17:41:51.440871 |
updated_at | 2022-08-29 03:04:07.023255 |
description | Small and simple argument parsing crate. |
homepage | |
repository | https://codeberg.org/BubbyRoosh/rargsxd |
max_upload_size | |
id | 355143 |
size | 13,573 |
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"]