2022-12-20 18:35:45 -05:00
|
|
|
use clap::{value_parser, Arg, ArgMatches, Command};
|
2022-12-20 12:05:21 -05:00
|
|
|
|
2022-12-20 18:35:45 -05:00
|
|
|
#[must_use]
|
2022-12-20 12:05:21 -05:00
|
|
|
pub fn cli() -> Command {
|
|
|
|
Command::new("bootstrap")
|
|
|
|
.version(env!("CARGO_PKG_VERSION"))
|
|
|
|
.author("Nathan Fisher")
|
|
|
|
.about("Install shitbox into the filesystem")
|
|
|
|
.long_about("Install symlinks, manpages and shell completions")
|
|
|
|
.args([
|
|
|
|
Arg::new("prefix")
|
|
|
|
.help("The directory path under which to install")
|
|
|
|
.short('p')
|
|
|
|
.long("prefix")
|
|
|
|
.num_args(1)
|
|
|
|
.default_value("/")
|
|
|
|
.required(false),
|
|
|
|
Arg::new("usr")
|
|
|
|
.help("Use /usr")
|
|
|
|
.long_help(
|
|
|
|
"Split the installation so that some applets go into /bin | /sbin\n\
|
|
|
|
while others are placed into /usr/bin | /usr/sbin",
|
|
|
|
)
|
|
|
|
.short('u')
|
|
|
|
.long("usr")
|
|
|
|
.default_value("true")
|
|
|
|
.value_parser(value_parser!(bool)),
|
|
|
|
])
|
|
|
|
.subcommands([
|
|
|
|
Command::new("all").about("Install everything"),
|
|
|
|
Command::new("links")
|
|
|
|
.about("Install links for each applet")
|
|
|
|
.arg(
|
|
|
|
Arg::new("soft")
|
|
|
|
.help("Install soft links instead of hardlinks")
|
|
|
|
.short('s')
|
|
|
|
.long("soft"),
|
|
|
|
),
|
|
|
|
Command::new("manpages")
|
|
|
|
.about("Install Unix man pages")
|
|
|
|
.alias("man"),
|
|
|
|
Command::new("completions")
|
|
|
|
.about("Install shell completions")
|
|
|
|
.alias("comp")
|
|
|
|
.args([
|
|
|
|
Arg::new("all")
|
|
|
|
.help("Install completions for all supported shells")
|
|
|
|
.short('a')
|
|
|
|
.long("all"),
|
|
|
|
Arg::new("bash")
|
|
|
|
.help("Bash shell completions")
|
|
|
|
.short('b')
|
|
|
|
.long("bash"),
|
|
|
|
Arg::new("fish")
|
|
|
|
.help("Fish shell completions")
|
|
|
|
.short('f')
|
|
|
|
.long("fish"),
|
|
|
|
Arg::new("nu")
|
|
|
|
.help("Nushell completions")
|
|
|
|
.short('n')
|
|
|
|
.long("nu"),
|
|
|
|
Arg::new("pwsh")
|
|
|
|
.help("PowerShell completions")
|
|
|
|
.short('p')
|
|
|
|
.long("pwsh"),
|
|
|
|
]),
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn run(matches: &ArgMatches) {}
|