mirror of
https://git.sr.ht/~nixgoat/vento
synced 2024-09-28 13:09:03 +00:00
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:
parent
24d962fa7b
commit
9b49385044
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue