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 clap::{crate_description, crate_name, Arg, Command};
pub(in crate) fn cli_builder() -> Command<'static> {
Command::new(crate_name!())
.about(crate_description!())
.subcommand_required(true)
.arg_required_else_help(true)
.allow_external_subcommands(false)
.arg(
Arg::new("verbose")
.short('v')
.long("verbose")
.takes_value(false)
.help("Enable verbose output"),
)
.arg(
Arg::new("root")
.short('r')
.long("root")
.takes_value(true)
.default_value(".")
.help("Root directory of your project"),
)
.subcommand(Command::new("init").about("Initialize a new site"))
.subcommand(
Command::new("build")
.about("Build the current site into the output directory")
.arg(
Arg::new("output")
.default_value("./out")
.short('o')
.long("output")
.takes_value(true)
.help("Sets the output dir"),
)
.arg(
Arg::new("drafts")
.short('d')
.long("drafts")
.takes_value(false)
.help("Include documents marked as drafts in the output"),
),
)
}