Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[macro_use]
- extern crate clap;
- extern crate rhp_vm;
- use clap::{Arg, App, ArgGroup};
- fn main() {
- let matches = App::new("rhp-cli")
- .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)
- .display_order(1)
- )
- .arg(Arg::with_name("file")
- .short("f")
- .long("file")
- .help("Parse and execute <file>")
- .takes_value(true)
- .number_of_values(1)
- .display_order(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")
- .display_order(1)
- )
- .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]")
- .display_order(1)
- )
- .group(ArgGroup::with_name("sapi")
- .args(&["interactive", "file", "run", "server"])
- .required(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")
- .display_order(5)
- .number_of_values(1)
- .overrides_with("no_php_ini")
- )
- .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)
- .display_order(6)
- )
- .arg(Arg::with_name("profile_info")
- .short("e")
- .long("profile-info")
- .help("Generate extended information for debugger/profiler")
- .display_order(7)
- )
- .arg(Arg::with_name("info")
- .short("i")
- .long("info")
- .help("PHP information")
- .display_order(8)
- )
- .arg(Arg::with_name("lint")
- .short("l")
- .long("syntax-check")
- .help("Syntax check only (lint)")
- .conflicts_with("run")
- .display_order(9)
- )
- .arg(Arg::with_name("modules")
- .short("m")
- .long("modules")
- .help("Show compiled in modules")
- .display_order(10)
- )
- .arg(Arg::with_name("no_php_ini")
- .short("n")
- .long("no-php-ini")
- .overrides_with("config")
- .help("No php.ini file will be used")
- .takes_value(false)
- .display_order(11)
- )
- .arg(Arg::with_name("syntax_highlight")
- .short("s")
- .long("syntax-highlight")
- .help("Output HTML syntax highlighted source")
- .alias("syntax-highlighting")
- .display_order(12)
- )
- .arg(Arg::with_name("docroot")
- .short("t")
- .long("docroot")
- .help("Specify document root <docroot> for built-in web server")
- .takes_value(true)
- .value_name("docroot")
- .display_order(13)
- )
- .arg(Arg::with_name("version")
- .short("v")
- .long("version")
- .help("Version number")
- .display_order(14)
- )
- .arg(Arg::with_name("strip")
- .short("w")
- .long("strip")
- .help("Output source with stripped comments and whitespace")
- .display_order(15)
- )
- .arg(Arg::with_name("zend_extension")
- .short("z")
- .long("zend-extension")
- .help("Load Zend extension <file>")
- .takes_value(true)
- .value_name("file")
- .display_order(16)
- )
- .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")
- .display_order(17)
- )
- .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")
- .display_order(19)
- )
- .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")
- .display_order(20)
- )
- .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")
- .display_order(21)
- )
- .arg(Arg::with_name("hide_args")
- .short("H")
- .help("Hide any passed arguments from external tools")
- .display_order(22)
- )
- .arg(Arg::with_name("ini")
- .long("ini")
- .help("Show configuration file names")
- .display_order(23)
- )
- .arg(Arg::with_name("rclass")
- .long("rc")
- .help("Show information about class <name>")
- .takes_value(true)
- .value_name("name")
- .alias("rclass")
- .display_order(25)
- )
- .arg(Arg::with_name("rextension")
- .long("re")
- .help("Show information about extension <name>")
- .takes_value(true)
- .value_name("name")
- .alias("rextension")
- .display_order(25)
- )
- .arg(Arg::with_name("rextinfo")
- .long("ri")
- .help("Show configuration for extension <name>")
- .takes_value(true)
- .value_name("name")
- .alias("rextinfo")
- .display_order(25)
- )
- .arg(Arg::with_name("rfunction")
- .long("rf")
- .help("Show information about function <name>")
- .takes_value(true)
- .value_name("name")
- .alias("rfunction")
- .display_order(25)
- )
- .arg(Arg::with_name("rzendextension")
- .long("rz")
- .help("Show information about Zend extension <name>")
- .takes_value(true)
- .value_name("name")
- .alias("rzendextension")
- .display_order(25)
- )
- .arg(Arg::with_name("bind_path")
- .short("b")
- .long("bindpath")
- .help("Bind Path for external FASTCGI Server mode (CGI only)")
- .display_order(30)
- )
- .arg(Arg::with_name("no_chdir")
- .short("C")
- .long("no-chdir")
- .help("Do not chdir to the script's directory (CGI only)")
- .display_order(30)
- )
- .arg(Arg::with_name("no_header")
- .short("q")
- .long("no-header")
- .help("Quiet-mode. Suppress HTTP header output (CGI only)")
- .display_order(30)
- )
- .arg(Arg::with_name("timing")
- .short("T")
- .long("timing")
- .help("Measure execution time of script repeated count times (CGI only)")
- .display_order(30)
- )
- .group(ArgGroup::with_name("cgi")
- .args(&["bind_path", "no_chdir", "no_header", "timing"])
- .required(false))
- .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("copy")
- .help("Show copyright/license info")
- .long("copy")
- .visible_alias("license")
- .display_order(35)
- )
- .get_matches();
- println!("{:?}", matches);
- }
Add Comment
Please, Sign In to add comment