2021-10-11 19:51:33 +00:00
|
|
|
use std::process::exit;
|
2021-09-14 20:38:41 +00:00
|
|
|
|
|
|
|
use clap::{App, AppSettings, Arg};
|
|
|
|
|
|
|
|
fn main() {
|
2021-10-15 19:59:33 +00:00
|
|
|
let app = App::new(env!("CARGO_CRATE_NAME"))
|
2021-09-14 20:38:41 +00:00
|
|
|
.setting(AppSettings::ArgRequiredElseHelp)
|
|
|
|
.arg(
|
|
|
|
Arg::new("install")
|
|
|
|
.long("install")
|
2021-11-18 16:17:15 +00:00
|
|
|
.help("Install hardlinks for all subcommands in path")
|
2021-09-14 20:38:41 +00:00
|
|
|
.exclusive(true)
|
|
|
|
.takes_value(true)
|
|
|
|
.default_missing_value("/usr/local/bin")
|
|
|
|
.use_delimiter(false),
|
|
|
|
)
|
|
|
|
.subcommand(App::new("true").about("does nothing successfully"))
|
|
|
|
.subcommand(App::new("false").about("does nothing unsuccessfully"));
|
2021-10-15 19:59:33 +00:00
|
|
|
|
|
|
|
let app = app.setting(AppSettings::Multicall);
|
|
|
|
let matches = app.get_matches();
|
2021-09-14 20:38:41 +00:00
|
|
|
if matches.occurrences_of("install") > 0 {
|
2021-10-11 19:51:33 +00:00
|
|
|
unimplemented!("Make hardlinks to the executable here");
|
2021-09-14 20:38:41 +00:00
|
|
|
}
|
|
|
|
|
2021-11-12 15:12:32 +00:00
|
|
|
match matches.subcommand_name() {
|
|
|
|
Some("true") => exit(0),
|
|
|
|
Some("false") => exit(1),
|
|
|
|
_ => unreachable!("parser should ensure only valid subcommand names are used"),
|
|
|
|
}
|
2021-09-14 20:38:41 +00:00
|
|
|
}
|