Crate rargsxd[−][src]
Example
use rargsxd::*; let args = vec!("testword".to_string(), "--testflag".to_string(), "-o".to_string(), "monke".to_string()); let mut parser = ArgParser::new("program_lol"); parser.author("BubbyRoosh") .version("0.1.0") .copyright("Copyright (C) 2021 BubbyRoosh") .info("Example for simple arg parsing crate OwO") .require_args(true) .args( vec!( Arg::new("testflag") .short('t') .help("This is a test flag.") .flag(false), Arg::new("testoption") .short('o') .help("This is a test option.") .option("option"), Arg::new("testword") .help("This is a test word.") .word(WordType::Boolean(false)), ) ).parse_vec(args); // .parse() uses std::env::args() so the args vec won't need to be passed. assert!(parser.get_flag("testflag").unwrap()); assert!(parser.get_word("testword").unwrap().as_bool().unwrap()); assert_eq!(parser.get_option("testoption").unwrap(), "monke");
Structs
Arg | An argument. |
ArgParser | Main parser struct. |
Enums
ArgType | Type of argument to check for. |
WordType |