From f2a946fad67161b65d09ce26bee6604d38b8c42f Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 14 Feb 2026 12:55:50 +0900 Subject: implement about command --- crates/mozart/src/commands/about.rs | 17 ++++++++++++++++- crates/mozart/src/console.rs | 31 +++++++++++++++++++++++++++++++ crates/mozart/src/lib.rs | 1 + 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 crates/mozart/src/console.rs (limited to 'crates/mozart/src') diff --git a/crates/mozart/src/commands/about.rs b/crates/mozart/src/commands/about.rs index bf3742d..4b12c08 100644 --- a/crates/mozart/src/commands/about.rs +++ b/crates/mozart/src/commands/about.rs @@ -1,8 +1,23 @@ +use crate::console; use clap::Args; #[derive(Args)] pub struct AboutArgs {} pub fn execute(_args: &AboutArgs, _cli: &super::Cli) -> anyhow::Result<()> { - todo!() + let version = env!("CARGO_PKG_VERSION"); + println!( + "{}", + console::info(&format!( + "Mozart - Dependency Manager for PHP - version {version}" + )) + ); + println!( + "{}", + console::comment( + "Mozart is a dependency manager tracking local dependencies of your projects and libraries. +See https://getcomposer.org/ for more information." + ) + ); + Ok(()) } diff --git a/crates/mozart/src/console.rs b/crates/mozart/src/console.rs new file mode 100644 index 0000000..43399a5 --- /dev/null +++ b/crates/mozart/src/console.rs @@ -0,0 +1,31 @@ +use colored::{ColoredString, Colorize}; + +/// `` — green foreground +pub fn info(message: &str) -> ColoredString { + message.green() +} + +/// `` — yellow foreground +pub fn comment(message: &str) -> ColoredString { + message.yellow() +} + +/// `` — white on red +pub fn error(message: &str) -> ColoredString { + message.white().on_red() +} + +/// `` — black on cyan +pub fn question(message: &str) -> ColoredString { + message.black().on_cyan() +} + +/// `` — red foreground (Composer extension) +pub fn highlight(message: &str) -> ColoredString { + message.red() +} + +/// `` — black on yellow (Composer extension) +pub fn warning(message: &str) -> ColoredString { + message.black().on_yellow() +} diff --git a/crates/mozart/src/lib.rs b/crates/mozart/src/lib.rs index 82b6da3..7a110c5 100644 --- a/crates/mozart/src/lib.rs +++ b/crates/mozart/src/lib.rs @@ -1 +1,2 @@ pub mod commands; +pub mod console; -- cgit v1.3.1