colours and formatting fixes

This commit is contained in:
aaron-jack-manning
2022-08-29 19:38:21 +10:00
parent c547fb8997
commit 93fa52611a
9 changed files with 240 additions and 155 deletions

View File

@@ -46,7 +46,7 @@ impl Config {
for (name, _) in &mut self.vaults {
if *name == new_name {
return Err(error::Error::Generic(format!("A vault named {} already exists", colour::vault(&new_name))));
return Err(error::Error::Generic(format!("A vault named {} already exists", colour::text::vault(&new_name))));
}
if name == old_name {
@@ -60,7 +60,7 @@ impl Config {
Ok(())
},
None => {
Err(error::Error::Generic(format!("No vault named {} exists", colour::vault(old_name))))
Err(error::Error::Generic(format!("No vault named {} exists", colour::text::vault(old_name))))
}
}
@@ -82,7 +82,7 @@ impl Config {
Ok(path)
},
None => {
Err(error::Error::Generic(format!("No vault by the name {} exists", colour::vault(name))))
Err(error::Error::Generic(format!("No vault by the name {} exists", colour::text::vault(name))))
}
}
}
@@ -94,7 +94,7 @@ impl Config {
Ok(())
},
None => {
Err(error::Error::Generic(format!("No vault by the name {} exists", colour::vault(name))))
Err(error::Error::Generic(format!("No vault by the name {} exists", colour::text::vault(name))))
}
}
}
@@ -105,7 +105,7 @@ impl Config {
let width = self.vaults.iter().fold(usize::MIN, |c, (n, _)| c.max(n.len()));
if self.vaults.is_empty() {
Err(error::Error::Generic(format!("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::text::command("toru vault new <NAME> <PATH>"))))
}
else {
for (i, (name, path)) in self.vaults.iter().enumerate() {
@@ -117,7 +117,7 @@ impl Config {
print!(" ");
}
print!("{}", colour::vault(name));
print!("{}", colour::text::vault(name));
let padding = width - name.len() + 1;