dragonrun1

Clap panic

May 7th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 8.84 KB | None | 0 0
  1. #[macro_use]
  2. extern crate clap;
  3. extern crate rhp_vm;
  4. use clap::{Arg, App, ArgGroup};
  5. fn main() {
  6.     let matches = App::new("rhp-cli")
  7.         .version("0.0.1")
  8.         .author(crate_authors!())
  9.         .about(crate_description!())
  10.         .bin_name("rhp-cli")
  11.         .template("Usage: {bin} [options] [-f] <file> [--] [args...]
  12.   {bin} [options] -r <code> [--] [args...]
  13.   {bin} [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
  14.   {bin} [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
  15.   {bin} [options] -S <addr>:<port> [-t docroot]
  16.   {bin} [options] -- [args...]
  17.   {bin} [options] -a
  18.  
  19. {unified}
  20.  
  21. {positionals}")
  22.         .arg(Arg::with_name("interactive")
  23.             .short("a")
  24.             .help("Run interactively")
  25.             .takes_value(false)
  26.             .display_order(1)
  27.         )
  28.         .arg(Arg::with_name("file")
  29.             .short("f")
  30.             .long("file")
  31.             .help("Parse and execute <file>")
  32.             .takes_value(true)
  33.             .number_of_values(1)
  34.             .display_order(1)
  35.         )
  36.         .arg(Arg::with_name("run")
  37.             .short("r")
  38.             .long("run")
  39.             .help("Run PHP <code> without using script tags <?..?>")
  40.             .takes_value(true)
  41.             .number_of_values(1)
  42.             .value_name("code")
  43.             .display_order(1)
  44.         )
  45.         .arg(Arg::with_name("server")
  46.             .short("S")
  47.             .long("server")
  48.             .help("Run with built-in web server")
  49.             .takes_value(true)
  50.             .number_of_values(1)
  51.             .value_name("[addr]:[port]")
  52.             .display_order(1)
  53.         )
  54.         .group(ArgGroup::with_name("sapi")
  55.             .args(&["interactive", "file", "run", "server"])
  56.             .required(false)
  57.         )
  58.         .arg(Arg::with_name("php_ini")
  59.             .short("c")
  60.             .long("php-ini")
  61.             .help("Look for php.ini file in the <path> or in this <file>")
  62.             .takes_value(true)
  63.             .value_name("path|file")
  64.             .display_order(5)
  65.             .number_of_values(1)
  66.             .overrides_with("no_php_ini")
  67.         )
  68.         .arg(Arg::with_name("define")
  69.             .short("d")
  70.             .long("define")
  71.             .help("Define INI entry foo with value 'bar'")
  72.             .takes_value(true)
  73.             .value_name("foo[=bar]")
  74.             .multiple(true)
  75.             .display_order(6)
  76.         )
  77.         .arg(Arg::with_name("profile_info")
  78.             .short("e")
  79.             .long("profile-info")
  80.             .help("Generate extended information for debugger/profiler")
  81.             .display_order(7)
  82.         )
  83.         .arg(Arg::with_name("info")
  84.             .short("i")
  85.             .long("info")
  86.             .help("PHP information")
  87.             .display_order(8)
  88.         )
  89.         .arg(Arg::with_name("lint")
  90.             .short("l")
  91.             .long("syntax-check")
  92.             .help("Syntax check only (lint)")
  93.             .conflicts_with("run")
  94.             .display_order(9)
  95.         )
  96.         .arg(Arg::with_name("modules")
  97.             .short("m")
  98.             .long("modules")
  99.             .help("Show compiled in modules")
  100.             .display_order(10)
  101.         )
  102.         .arg(Arg::with_name("no_php_ini")
  103.             .short("n")
  104.             .long("no-php-ini")
  105.             .overrides_with("config")
  106.             .help("No php.ini file will be used")
  107.             .takes_value(false)
  108.             .display_order(11)
  109.         )
  110.         .arg(Arg::with_name("syntax_highlight")
  111.             .short("s")
  112.             .long("syntax-highlight")
  113.             .help("Output HTML syntax highlighted source")
  114.             .alias("syntax-highlighting")
  115.             .display_order(12)
  116.         )
  117.         .arg(Arg::with_name("docroot")
  118.             .short("t")
  119.             .long("docroot")
  120.             .help("Specify document root <docroot> for built-in web server")
  121.             .takes_value(true)
  122.             .value_name("docroot")
  123.             .display_order(13)
  124.         )
  125.         .arg(Arg::with_name("version")
  126.             .short("v")
  127.             .long("version")
  128.             .help("Version number")
  129.             .display_order(14)
  130.         )
  131.         .arg(Arg::with_name("strip")
  132.             .short("w")
  133.             .long("strip")
  134.             .help("Output source with stripped comments and whitespace")
  135.             .display_order(15)
  136.         )
  137.         .arg(Arg::with_name("zend_extension")
  138.             .short("z")
  139.             .long("zend-extension")
  140.             .help("Load Zend extension <file>")
  141.             .takes_value(true)
  142.             .value_name("file")
  143.             .display_order(16)
  144.         )
  145.         .arg(Arg::with_name("process_begin")
  146.             .short("B")
  147.             .long("process-begin")
  148.             .help("Run PHP <begin_code> before processing input lines")
  149.             .takes_value(true)
  150.             .value_name("begin_code")
  151.             .display_order(17)
  152.         )
  153.         .arg(Arg::with_name("process_code")
  154.             .short("R")
  155.             .long("process-code")
  156.             .help("Run PHP <code> for every input line")
  157.             .takes_value(true)
  158.             .value_name("code")
  159.             .display_order(19)
  160.         )
  161.         .arg(Arg::with_name("process_file")
  162.             .short("F")
  163.             .long("process-file")
  164.             .help("Parse and execute <file> for every input line")
  165.             .takes_value(true)
  166.             .value_name("file")
  167.             .display_order(20)
  168.         )
  169.         .arg(Arg::with_name("process_end")
  170.             .short("E")
  171.             .long("process-end")
  172.             .help("Run PHP <end_code> after processing all input lines")
  173.             .takes_value(true)
  174.             .value_name("end_code")
  175.             .display_order(21)
  176.         )
  177.         .arg(Arg::with_name("hide_args")
  178.             .short("H")
  179.             .help("Hide any passed arguments from external tools")
  180.             .display_order(22)
  181.         )
  182.         .arg(Arg::with_name("ini")
  183.             .long("ini")
  184.             .help("Show configuration file names")
  185.             .display_order(23)
  186.         )
  187.         .arg(Arg::with_name("rclass")
  188.             .long("rc")
  189.             .help("Show information about class <name>")
  190.             .takes_value(true)
  191.             .value_name("name")
  192.             .alias("rclass")
  193.             .display_order(25)
  194.         )
  195.         .arg(Arg::with_name("rextension")
  196.             .long("re")
  197.             .help("Show information about extension <name>")
  198.             .takes_value(true)
  199.             .value_name("name")
  200.             .alias("rextension")
  201.             .display_order(25)
  202.         )
  203.         .arg(Arg::with_name("rextinfo")
  204.             .long("ri")
  205.             .help("Show configuration for extension <name>")
  206.             .takes_value(true)
  207.             .value_name("name")
  208.             .alias("rextinfo")
  209.             .display_order(25)
  210.         )
  211.         .arg(Arg::with_name("rfunction")
  212.             .long("rf")
  213.             .help("Show information about function <name>")
  214.             .takes_value(true)
  215.             .value_name("name")
  216.             .alias("rfunction")
  217.             .display_order(25)
  218.         )
  219.         .arg(Arg::with_name("rzendextension")
  220.             .long("rz")
  221.             .help("Show information about Zend extension <name>")
  222.             .takes_value(true)
  223.             .value_name("name")
  224.             .alias("rzendextension")
  225.             .display_order(25)
  226.         )
  227.         .arg(Arg::with_name("bind_path")
  228.             .short("b")
  229.             .long("bindpath")
  230.             .help("Bind Path for external FASTCGI Server mode (CGI only)")
  231.             .display_order(30)
  232.         )
  233.         .arg(Arg::with_name("no_chdir")
  234.             .short("C")
  235.             .long("no-chdir")
  236.             .help("Do not chdir to the script's directory (CGI only)")
  237.             .display_order(30)
  238.         )
  239.         .arg(Arg::with_name("no_header")
  240.             .short("q")
  241.             .long("no-header")
  242.             .help("Quiet-mode. Suppress HTTP header output (CGI only)")
  243.             .display_order(30)
  244.         )
  245.         .arg(Arg::with_name("timing")
  246.             .short("T")
  247.             .long("timing")
  248.             .help("Measure execution time of script repeated count times (CGI only)")
  249.             .display_order(30)
  250.         )
  251.         .group(ArgGroup::with_name("cgi")
  252.             .args(&["bind_path", "no_chdir", "no_header", "timing"])
  253.             .required(false))
  254.         .arg(Arg::with_name("args")
  255.             .help("Arguments passed to script. Use -- args when first argument starts with - or script is read from stdin")
  256.             .multiple(true)
  257.         )
  258.         .arg(Arg::with_name("copy")
  259.             .help("Show copyright/license info")
  260.             .long("copy")
  261.             .visible_alias("license")
  262.             .display_order(35)
  263.         )
  264.         .get_matches();
  265.     println!("{:?}", matches);
  266. }
Add Comment
Please, Sign In to add comment