inv: list: Code cleanup

inv::list() had quite an unnecessary function so I cleaned the code a
bit so it works a bit more cleanly™
This commit is contained in:
Lux Aliaga 2022-09-14 16:14:07 -03:00
parent 24d962fa7b
commit 9b49385044
1 changed files with 1 additions and 7 deletions

View File

@ -25,14 +25,8 @@ pub fn init() { // Initializes Vento
pub fn list(slot: &str) { // Lists files in inventory
let ventodir: PathBuf = env_config();
let active: PathBuf = [ventodir.to_path_buf(), Path::new("active").to_path_buf()].iter().collect();
let inactive: PathBuf = [ventodir.to_path_buf(), Path::new("inactive").to_path_buf()].iter().collect();
let slotdir: PathBuf;
let slotdir: PathBuf = [ventodir.to_path_buf(), Path::new(slot).to_path_buf()].iter().collect();
match slot { // Determines which slot has been selected
"inactive" => slotdir = inactive,
"active" | _ => slotdir = active
};
println!("🗃️ {}", format!("Files in {} inventory:", match slot {
"active" => format!("{}", slot).bold(),
"inactive" | _ => format!("{}", slot).blue().bold()