extern crate arg_soup; use arg_soup::Parser; use std::env; fn main() { // Args are collected let args: Vec = env::args().collect(); // Parser is created let mut parser = Parser::new(args); // Actions are added parser.add_action("--help", Box::new(|| println!("Some text"))); parser.add_action("--cats", Box::new(|| println!("Meow"))); // Flags are added parser.add_flag("-o"); parser.add_flag("-z"); // If the program is ran with "--help" and / or "--cats" // The corresponding functions will be called // If run with "-o" or "-z" their resulting values will be collected as well. parser.execute_actions(); let flags = parser.collect_flags(); println!("{:?}", flags); }