calcit/
cli_args.rs

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