Repository navigation
Expand file tree
/
Copy pathcli.rs
More file actions
46 lines (44 loc) · 2.28 KB
/
Copy pathcli.rs
File metadata and controls
46 lines (44 loc) · 2.28 KB
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
use std::path::PathBuf;
use clap::{arg, command, value_parser, ArgAction, Command};
pub(super) fn make_command() -> Command {
command!()
.args([
arg!(-f --format <FORMAT> "the format of the input data")
.value_parser([
"auto",
"json",
#[cfg(feature = "querystring")]
"querystring",
#[cfg(feature = "yaml")]
"yaml",
#[cfg(feature = "toml")]
"toml",
#[cfg(feature = "cbor")]
"cbor",
])
.default_value("auto"),
arg!(-a --autoescape <MODE> "reconfigures autoescape behavior")
.value_parser(["auto", "html", "json", "none"])
.default_value("auto"),
arg!(-D --define <EXPR> "defines an input variable (key=value)")
.action(ArgAction::Append),
arg!(--strict "disallow undefined variables in templates"),
arg!(--"no-include" "Disallow includes and extending"),
arg!(--"no-newline" "Do not output a newline"),
arg!(--env "Pass environment variables as ENV to the template"),
arg!(-E --expr <EXPR> "Evaluates an expression instead"),
arg!(--"expr-out" <MODE> "Sets the expression output mode")
.value_parser(["print", "json", "json-pretty", "status"])
.default_value("print")
.requires("expr"),
arg!(--fuel <AMOUNT> "configures the maximum fuel").value_parser(value_parser!(u64)),
arg!(--dump <KIND> "dump internals of a template").value_parser(["instructions", "ast", "tokens"]),
#[cfg(feature = "repl")]
arg!(--repl "starts the repl with the given data")
.conflicts_with_all(["expr", "template"]),
arg!(template: [TEMPLATE] "path to the input template").default_value("-"),
arg!(data: [DATA] "path to the data file").value_parser(value_parser!(PathBuf)),
])
.about("minijinja-cli is a command line tool to render or evaluate jinja2 templates.")
.after_help("For more information see https://github.com/mitsuhiko/minijinja/tree/main/minijinja-cli/README.md")
}