You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
amethyst/src/main.rs

39 lines
1.3 KiB
Rust

mod mods;
use clap::{App, Arg, SubCommand};
3 years ago
fn main() {
let matches = App::new("Amethyst")
.version(env!("CARGO_PKG_VERSION"))
.about(env!("CARGO_PKG_DESCRIPTION"))
.arg(
Arg::with_name("verbose")
.short("v")
.multiple(true)
.help("Sets the level of verbosity"),
)
.subcommand(
SubCommand::with_name ("install")
.about("Installs a package from either the AUR or the PacMan-defined repositories")
.arg(
Arg::with_name("noconfirm")
.short("y")
.long("noconfirm")
.help("Do not ask for confirmation before installing the package")
)
.arg(
Arg::with_name("package")
.help("The name of the package to install")
.required(true)
.index(1)
)
)
.get_matches();
match matches.occurrences_of("verbose") {
0 => println!("No verbosity"),
1 => println!("Some extra information"),
2 => println!("Plenty of debug text"),
_ => println!("Screensaver mode"),
}
}