coloured terminal outputs

This commit is contained in:
Hlars 2025-01-10 19:48:56 +01:00
parent 28a29b41ef
commit 09187ba76e
2 changed files with 15 additions and 3 deletions

View File

@ -4,16 +4,20 @@
"axum",
"chrono",
"color",
"colored",
"Conn",
"dotenv",
"hmac",
"minisign",
"oneshot",
"openapi",
"postgres",
"recv",
"repr",
"serde",
"Servable",
"sqlx",
"tokio",
"utoipa"
]
}

View File

@ -1,6 +1,7 @@
use std::{collections::HashSet, path::PathBuf};
use clap::{command, Parser, Subcommand};
use colored::Colorize;
use error_stack::{Report, ResultExt};
use sqlx::PgPool;
use tokio::sync::mpsc::UnboundedReceiver;
@ -97,7 +98,8 @@ impl Cli {
windows::install_service()?;
// Print success message
println!("Succssfully installed service {APP_NAME}");
let msg = format!("Successfully installed service {APP_NAME}").green();
println!("{msg}");
Ok(DaemonStatus::NotRunning)
}
@ -106,7 +108,8 @@ impl Cli {
windows::uninstall_service()?;
// Print success message
println!("Succssfully removed service {APP_NAME}");
let msg = format!("Successfully removed service {APP_NAME}").green();
println!("{msg}");
Ok(DaemonStatus::NotRunning)
}
@ -141,7 +144,12 @@ impl Cli {
create_api_key(&pool, &key).await.change_context(AppError)?;
// print API key secret to console
println!("Created API Key: {}.{key_secret}", key.id);
println!(
"{}: {}.{}",
"Created API Key".green().bold(),
key.id.bold(),
key_secret.bold()
);
Ok(DaemonStatus::NotRunning)
}