diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-14 12:55:50 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-14 12:55:50 +0900 |
| commit | f2a946fad67161b65d09ce26bee6604d38b8c42f (patch) | |
| tree | 78a1c402fa1f9fab4a3724624053d81e95f761a1 /crates/mozart | |
| parent | 08a845acdd831a9de186696b9614ee397c8e7c68 (diff) | |
| download | php-mozart-f2a946fad67161b65d09ce26bee6604d38b8c42f.tar.gz php-mozart-f2a946fad67161b65d09ce26bee6604d38b8c42f.tar.zst php-mozart-f2a946fad67161b65d09ce26bee6604d38b8c42f.zip | |
implement about command
Diffstat (limited to 'crates/mozart')
| -rw-r--r-- | crates/mozart/src/commands/about.rs | 17 | ||||
| -rw-r--r-- | crates/mozart/src/console.rs | 31 | ||||
| -rw-r--r-- | crates/mozart/src/lib.rs | 1 |
3 files changed, 48 insertions, 1 deletions
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}; + +/// `<info>` — green foreground +pub fn info(message: &str) -> ColoredString { + message.green() +} + +/// `<comment>` — yellow foreground +pub fn comment(message: &str) -> ColoredString { + message.yellow() +} + +/// `<error>` — white on red +pub fn error(message: &str) -> ColoredString { + message.white().on_red() +} + +/// `<question>` — black on cyan +pub fn question(message: &str) -> ColoredString { + message.black().on_cyan() +} + +/// `<highlight>` — red foreground (Composer extension) +pub fn highlight(message: &str) -> ColoredString { + message.red() +} + +/// `<warning>` — 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; |
