mirror of https://git.sr.ht/~nixgoat/vento
Compare commits
2 Commits
e9aa1b2ee1
...
343c97e92c
Author | SHA1 | Date |
---|---|---|
Lux Aliaga | 343c97e92c | |
Lux Aliaga | 9589fcb674 |
|
@ -120,7 +120,11 @@ fn main() -> Result<()> {
|
||||||
} else if cli.import_dir.is_some() {
|
} else if cli.import_dir.is_some() {
|
||||||
archive::import_dir(cli.import_dir.unwrap(), true)?
|
archive::import_dir(cli.import_dir.unwrap(), true)?
|
||||||
} else {
|
} else {
|
||||||
inv::list(cli.slot.unwrap_or(String::from("active")).as_str(), dir)?
|
inv::list(
|
||||||
|
cli.slot.clone().unwrap_or(String::from("active")).as_str(),
|
||||||
|
dir,
|
||||||
|
cli.slot.is_some(),
|
||||||
|
)?
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
27
src/inv.rs
27
src/inv.rs
|
@ -49,7 +49,7 @@ pub fn init() -> Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Lists files in the provided slot and/or directory
|
/// Lists files in the provided slot and/or directory
|
||||||
pub fn list(slot: &str, dir: &str) -> Result<()> {
|
pub fn list(slot: &str, dir: &str, display_slot: bool) -> Result<()> {
|
||||||
let ventodir = &common::env_config()?.vento_dir;
|
let ventodir = &common::env_config()?.vento_dir;
|
||||||
|
|
||||||
if !ventodir.is_dir() {
|
if !ventodir.is_dir() {
|
||||||
|
@ -93,9 +93,13 @@ pub fn list(slot: &str, dir: &str) -> Result<()> {
|
||||||
append_emoji(EmojiType::Inventory)?,
|
append_emoji(EmojiType::Inventory)?,
|
||||||
format!(
|
format!(
|
||||||
"No files in {}{}",
|
"No files in {}{}",
|
||||||
match slot {
|
if display_slot || dir != "" {
|
||||||
"active" => slot.bold(),
|
match slot {
|
||||||
_ => slot.blue().bold(),
|
"active" => slot.bold(),
|
||||||
|
_ => slot.blue().bold(),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
"inventory".clear()
|
||||||
},
|
},
|
||||||
if !dir.is_empty() {
|
if !dir.is_empty() {
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
|
@ -114,10 +118,17 @@ pub fn list(slot: &str, dir: &str) -> Result<()> {
|
||||||
"{}{}",
|
"{}{}",
|
||||||
append_emoji(EmojiType::Inventory)?,
|
append_emoji(EmojiType::Inventory)?,
|
||||||
format!(
|
format!(
|
||||||
"Files in {}{} ({}):",
|
"Files in{}{} ({}):",
|
||||||
match slot {
|
if display_slot || dir != "" {
|
||||||
"active" => slot.bold(),
|
format!(
|
||||||
_ => slot.blue().bold(),
|
" {}",
|
||||||
|
match slot {
|
||||||
|
"active" => slot.bold(),
|
||||||
|
_ => slot.blue().bold(),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
String::new()
|
||||||
},
|
},
|
||||||
if !dir.is_empty() {
|
if !dir.is_empty() {
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
|
|
|
@ -92,7 +92,7 @@ pub fn take(file: &String, slot: &str, message: bool, display_slot: bool) -> Res
|
||||||
"Took".green(),
|
"Took".green(),
|
||||||
&filename.bold(),
|
&filename.bold(),
|
||||||
match parse_config()?.display_dir {
|
match parse_config()?.display_dir {
|
||||||
true => format! {"{} {} ",
|
true => format! {"{} {}",
|
||||||
" from".green(),
|
" from".green(),
|
||||||
&sourcelocation.to_str().unwrap(),
|
&sourcelocation.to_str().unwrap(),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue