1
0
Fork 0
mirror of https://git.sr.ht/~nixgoat/vento synced 2024-11-16 03:53:04 +00:00

main: Command shortcodes

This commit adds shorter versions of commands, so you can save time!
This commit is contained in:
Lux Aliaga 2022-09-15 00:22:49 -03:00
parent 7e547e40fc
commit 68223011da

View file

@ -30,24 +30,24 @@ fn main() {
let args: Vec<String> = env::args().collect(); let args: Vec<String> = env::args().collect();
if args.len() >= 2 { if args.len() >= 2 {
match args[1].as_str() { match args[1].as_str() {
"help" => help(), "help" | "h" => help(),
"init" => inv::init(), "init" | "i" => inv::init(),
"list" => { "list" | "l" => {
if args.len() == 3 { if args.len() == 3 {
inv::list(args[2].as_str()); inv::list(args[2].as_str());
} else { } else {
inv::list("active"); inv::list("active");
}; };
}, },
"switch" => inv::switch(), "switch" | "s" => inv::switch(),
"take" => { "take" | "t" => {
if args.len() == 3 { if args.len() == 3 {
item::take(&args[2]); item::take(&args[2]);
} else { } else {
println!("{}", format!("You need to specify a file.").red()) println!("{}", format!("You need to specify a file.").red())
}; };
}, },
"drop" => { "drop" | "d" => {
if args.len() == 3 { if args.len() == 3 {
item::drop(&args[2], match env::current_dir() { item::drop(&args[2], match env::current_dir() {
Ok(dir) => dir, Ok(dir) => dir,
@ -82,10 +82,10 @@ fn help() {
- {}: Displays this message", - {}: Displays this message",
format!("Vento").bold().blue(), format!("Vento").bold().blue(),
format!("Usage:").bold(), format!("Usage:").bold(),
format!("take <file | directory>").bold().green(), format!("take | t <file | directory>").bold().green(),
format!("drop <file | directory> [destination]").bold().green(), format!("drop | d <file | directory> [destination]").bold().green(),
format!("list [slot]").bold().green(), format!("list | l [slot]").bold().green(),
format!("switch").bold().green(), format!("switch | s").bold().green(),
format!("init").bold().green(), format!("init | i").bold().green(),
format!("help").bold().green()); format!("help | h").bold().green());
} }