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", "axum",
"chrono", "chrono",
"color", "color",
"colored",
"Conn", "Conn",
"dotenv", "dotenv",
"hmac", "hmac",
"minisign", "minisign",
"oneshot", "oneshot",
"openapi", "openapi",
"postgres",
"recv", "recv",
"repr", "repr",
"serde",
"Servable", "Servable",
"sqlx", "sqlx",
"tokio",
"utoipa" "utoipa"
] ]
} }

View File

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