feat: add colour to bitwarden error messages
Diff
src/bwutil.rs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
@@ -1,4 +1,5 @@
use std::process::{Command, Output, Stdio};
use colored::*;
use serde::Deserialize;
use anyhow::{anyhow, Result, Context};
@@ -77,7 +78,7 @@ pub fn exec_folder_search(session: &str, folder_name: &str) -> Result<Vec<Bitwar
["list", "folders", "--search", &folder_name, "--session", &session].to_vec());
let result: String = String::from_utf8_lossy(&folders.stdout).to_string();
if result.is_empty() {
Err(anyhow!("Could not authenticate."))
Err(anyhow!("Could not authenticate. This could mean your session has expired.".red()))
}
else {
Ok(serde_json::from_str(&result).with_context(|| "Could not deserialize folder search results.")?)
@@ -90,7 +91,7 @@ pub fn exec_list_folder_items(session: &str, folder_id: &str) -> Result<Vec<Bitw
["list", "items", "--folderid", &folder_id, "--session", &session].to_vec());
let result = String::from_utf8_lossy(&items.stdout).to_string();
if result.is_empty() {
Err(anyhow!("Could not authenticate."))
Err(anyhow!("Could not authenticate. This could mean your session has expired.".red()))
}
else {
Ok(serde_json::from_str(&result).with_context(|| "Could not deserialize item search results.")?)