mirror of
https://git.sr.ht/~nixgoat/vento
synced 2024-11-16 12:02:49 +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
|
pub fn list(slot: &str) { // Lists files in inventory
|
||||||
let ventodir: PathBuf = env_config();
|
let ventodir: PathBuf = env_config();
|
||||||
let active: PathBuf = [ventodir.to_path_buf(), Path::new("active").to_path_buf()].iter().collect();
|
let slotdir: PathBuf = [ventodir.to_path_buf(), Path::new(slot).to_path_buf()].iter().collect();
|
||||||
let inactive: PathBuf = [ventodir.to_path_buf(), Path::new("inactive").to_path_buf()].iter().collect();
|
|
||||||
let slotdir: PathBuf;
|
|
||||||
|
|
||||||
match slot { // Determines which slot has been selected
|
|
||||||
"inactive" => slotdir = inactive,
|
|
||||||
"active" | _ => slotdir = active
|
|
||||||
};
|
|
||||||
println!("🗃️ {}", format!("Files in {} inventory:", match slot {
|
println!("🗃️ {}", format!("Files in {} inventory:", match slot {
|
||||||
"active" => format!("{}", slot).bold(),
|
"active" => format!("{}", slot).bold(),
|
||||||
"inactive" | _ => format!("{}", slot).blue().bold()
|
"inactive" | _ => format!("{}", slot).blue().bold()
|
||||||
|
|
Loading…
Reference in a new issue