Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[macro_use]
- extern crate clap;
- use clap::{App, AppSettings, Arg, ArgGroup};
- fn main() {
- let matches = App::new("rhp-cli")
- .setting(AppSettings::DeriveDisplayOrder)
- .version("0.0.1")
- .author(crate_authors!())
- .about(crate_description!())
- .bin_name("rhp-cli")
- .template("Usage: {bin} [options] [-f] <file> [--] [args...]
- {bin} [options] -r <code> [--] [args...]
- {bin} [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
- {bin} [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
- {bin} [options] -S <addr>:<port> [-t docroot]
- {bin} [options] -- [args...]
- {bin} [options] -a
- {unified}
- {positionals}")
- .arg(Arg::with_name("interactive")
- .short("a")
- .help("Run interactively")
- .takes_value(false)
- )
- .arg(Arg::with_name("php_ini")
- .short("c")
- .long("php-ini")
- .help("Look for php.ini file in the <path> or in this <file>")
- .takes_value(true)
- .value_name("path|file")
- .number_of_values(1)
- )
- .arg(Arg::with_name("no_php_ini")
- .short("n")
- .long("no-php-ini")
- .overrides_with("php_ini")
- .help("No php.ini file will be used")
- .takes_value(false)
- )
- .arg(Arg::with_name("define")
- .short("d")
- .long("define")
- .help("Define INI entry foo with value 'bar'")
- .takes_value(true)
- .value_name("foo[=bar]")
- .multiple(true)
- )
- .arg(Arg::with_name("profile_info")
- .short("e")
- .long("profile-info")
- .help("Generate extended information for debugger/profiler")
- )
- .arg(Arg::with_name("file")
- .short("f")
- .long("file")
- .help("Parse and execute <file>")
- .takes_value(true)
- .number_of_values(1)
- )
- .arg(Arg::with_name("run")
- .short("r")
- .long("run")
- .help("Run PHP <code> without using script tags <?..?>")
- .takes_value(true)
- .number_of_values(1)
- .value_name("code")
- )
- .arg(Arg::with_name("server")
- .short("S")
- .long("server")
- .help("Run with built-in web server")
- .takes_value(true)
- .number_of_values(1)
- .value_name("[addr]:[port]")
- )
- .arg(Arg::with_name("zend_extension")
- .short("z")
- .long("zend-extension")
- .help("Load Zend extension <file>")
- .takes_value(true)
- .value_name("file")
- )
- .arg(Arg::with_name("process_begin")
- .short("B")
- .long("process-begin")
- .help("Run PHP <begin_code> before processing input lines")
- .takes_value(true)
- .value_name("begin_code")
- )
- .arg(Arg::with_name("process_code")
- .short("R")
- .long("process-code")
- .help("Run PHP <code> for every input line")
- .takes_value(true)
- .value_name("code")
- )
- .arg(Arg::with_name("process_file")
- .short("F")
- .long("process-file")
- .help("Parse and execute <file> for every input line")
- .takes_value(true)
- .value_name("file")
- )
- .arg(Arg::with_name("process_end")
- .short("E")
- .long("process-end")
- .help("Run PHP <end_code> after processing all input lines")
- .takes_value(true)
- .value_name("end_code")
- )
- .arg(Arg::with_name("args")
- .help("Arguments passed to script. Use -- args when first argument starts with - or script is read from stdin")
- .multiple(true)
- )
- .arg(Arg::with_name("ini")
- .long("ini")
- .help("Show configuration file names")
- )
- .arg(Arg::with_name("rclass")
- .long("rc")
- .help("Show information about class <name>")
- .takes_value(true)
- .value_name("name")
- .alias("rclass")
- )
- .arg(Arg::with_name("rextension")
- .long("re")
- .help("Show information about extension <name>")
- .takes_value(true)
- .value_name("name")
- .alias("rextension")
- )
- .arg(Arg::with_name("rextinfo")
- .long("ri")
- .help("Show configuration for extension <name>")
- .takes_value(true)
- .value_name("name")
- .alias("rextinfo")
- )
- .arg(Arg::with_name("rfunction")
- .long("rf")
- .help("Show information about function <name>")
- .takes_value(true)
- .value_name("name")
- .alias("rfunction")
- )
- .arg(Arg::with_name("rzendextension")
- .long("rz")
- .help("Show information about Zend extension <name>")
- .takes_value(true)
- .value_name("name")
- .alias("rzendextension")
- )
- .arg(Arg::with_name("copy")
- .help("Show copyright/license info")
- .long("copy")
- .visible_alias("license")
- )
- .group(ArgGroup::with_name("sapi")
- .args(&["interactive", "file", "run", "server"])
- .required(false)
- )
- .group(ArgGroup::with_name("cgi")
- .args(&["bind_path", "no_chdir", "no_header", "timing"])
- .required(false))
- .get_matches();
- println!("{:?}", matches);
- }
- #[cfg(test)]
- mod tests {
- use super::super::test::*;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement