1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
pub const CALCIT_VERSION: &str = env!("CARGO_PKG_VERSION"); pub fn parse_cli<'a>() -> clap::ArgMatches<'a> { clap::App::new("Calcit Runner") .version(CALCIT_VERSION) .author("Jon. <jiyinyiyong@gmail.com>") .about("Calcit Runner") .arg( clap::Arg::with_name("once") .help("disable watching mode") .default_value("false") .short("1") .long("once") .takes_value(false), ) .arg( clap::Arg::with_name("emit-js") .help("emit js rather than interpreting") .default_value("false") .long("emit-js") .takes_value(false), ) .arg( clap::Arg::with_name("emit-ir") .help("emit JSON representation of program to program-ir.json") .default_value("false") .long("emit-ir") .takes_value(false), ) .arg( clap::Arg::with_name("eval") .help("eval a snippet") .short("e") .long("eval") .takes_value(true), ) .arg( clap::Arg::with_name("emit-path") .help("emit directory for js, defaults to `js-out/`") .long("emit-path") .takes_value(true), ) .arg( clap::Arg::with_name("init-fn") .help("overwrite `init_fn`") .long("init-fn") .takes_value(true), ) .arg( clap::Arg::with_name("reload-fn") .help("overwrite `reload_fn`") .long("reload-fn") .takes_value(true), ) .arg( clap::Arg::with_name("event-entry") .help("entry ns/def for handling events") .long("event-entry") .default_value("app.main/on-window-event") .takes_value(true), ) .arg( clap::Arg::with_name("watch-dir") .help("a folder of assets that also being watched") .long("watch-dir") .takes_value(true), ) .arg( clap::Arg::with_name("reload-libs") .help("reload libs data during code reload") .long("reload-libs") .takes_value(false), ) .arg( clap::Arg::with_name("input") .help("entry file path, defaults to compact.cirru") .default_value("compact.cirru") .index(1), ) .get_matches() }