arg_parse for rust

Description

arg_pare is a tool to simplify the processing of command line arguments. It doesn't have any dependencies and the initialization is done at compile time.

Features

Installation

Add arg_parse = "0.1.0" to your cargo dependencies (cargo.toml). toml [dependencies] arg_parse = "0.1.0"

# Example Prints if the flag --a is provided and the parameter provided under -b ```rust use argparse::ArgParser; use argparse::config; // Define all Arguments of the program itself/root command (compile time) const ARGS: &'static [config::Arg] = &[config::Arg::Flag("a"), config::Arg::Parameter("b")]; // Define the Root Command, without any possible sub commands (compile time) const PARSERROOTCMD: config::Cmd = config::Cmd::from(ARGS, &[]); // Create the Parser in static memory, available everywhere (Created at compile time) static PARSER: ArgParser = ArgParser::from(PARSERROOTCMD);

fn main() { //Parse the by the user provided Arguments let rootcmd = PARSER.parse(); match rootcmd { Ok(result) => println!("Result: {:?}", result), Err(error) => println!("ERROR: {:?}", error) } } ```

Links:

Github Repo
Crates.io