feat: add information!()
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use clap::{ App, Arg, ArgMatches, };
|
||||
use crate::cmd::CommandError;
|
||||
use crate::information;
|
||||
|
||||
pub struct CommandDefault;
|
||||
|
||||
@@ -10,8 +11,8 @@ impl CommandDefault {
|
||||
}
|
||||
|
||||
pub fn run(_arg_matches: &ArgMatches) -> CommandError {
|
||||
println!("Git status: {}", crate::git::check_git_status());
|
||||
println!("Git hash : {}", crate::git::get_git_hash().unwrap_or_else(|| "<none>".to_owned()));
|
||||
information!("Git status: {}", crate::git::check_git_status());
|
||||
information!("Git hash : {}", crate::git::get_git_hash().unwrap_or_else(|| "<none>".to_owned()));
|
||||
error!("Default command is not implemented!");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ use cmd::{ Command, CommandError };
|
||||
use cmd_default::CommandDefault;
|
||||
use cmd_new::CommandNew;
|
||||
|
||||
#[macro_export] macro_rules! information {
|
||||
($($arg:tt)+) => ( crate::print_in(&format!($($arg)+)); )
|
||||
}
|
||||
#[macro_export] macro_rules! success {
|
||||
($($arg:tt)+) => ( crate::print_ok(&format!($($arg)+)); )
|
||||
}
|
||||
@@ -19,6 +22,10 @@ use cmd_new::CommandNew;
|
||||
($($arg:tt)+) => ( crate::print_wa(&format!($($arg)+)); )
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn print_in (msg: &str) {
|
||||
println!("{b}[INFO]{e} {m}", b = "\x1B[1m", e = "\x1B[0m", m = msg);
|
||||
}
|
||||
#[inline]
|
||||
fn print_ok (msg: &str) {
|
||||
println!("{g}{b}[ OK ]{e} {g}{m}{e}", g = "\x1B[92m", b = "\x1B[1m", e = "\x1B[0m", m = msg);
|
||||
|
||||
Reference in New Issue
Block a user