git text editor opening bug fixed; display functions for individual

tasks and lists
This commit is contained in:
aaron-jack-manning
2022-08-21 09:58:05 +10:00
parent 1cc7adfeb8
commit 6670cc4c24
9 changed files with 420 additions and 35 deletions

View File

@@ -64,12 +64,12 @@ impl Config {
}
/// Lists all vaults to stdout.
pub fn list_vaults(&self) {
pub fn list_vaults(&self) -> Result<(), error::Error> {
let width = self.vaults.iter().fold(usize::MIN, |c, (n, _)| c.max(n.len()));
if self.vaults.is_empty() {
println!("No vaults currently set up, try running: {}", colour::command("toru vault new <NAME> <PATH>"));
Err(error::Error::Generic(format!("No vaults currently set up, try running: {}", colour::command("toru vault new <NAME> <PATH>"))))
}
else {
for (i, (name, path)) in self.vaults.iter().enumerate() {
@@ -93,6 +93,8 @@ impl Config {
println!();
}
Ok(())
}
}
}