mirror of
https://github.com/sergi0g/cup.git
synced 2025-11-18 01:43:41 -05:00
Add debug option to CLI
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#[macro_export]
|
||||
macro_rules! error {
|
||||
($($arg:tt)*) => ({
|
||||
eprintln!("\x1b[38:5:204mERROR \x1b[0m {}", format!($($arg)*));
|
||||
eprintln!("\x1b[31;1mERROR \x1b[0m {}", format!($($arg)*));
|
||||
std::process::exit(1);
|
||||
})
|
||||
}
|
||||
@@ -13,20 +13,22 @@ macro_rules! error {
|
||||
#[macro_export]
|
||||
macro_rules! warn {
|
||||
($($arg:tt)*) => ({
|
||||
eprintln!("\x1b[38:5:192mWARN \x1b[0m {}", format!($($arg)*));
|
||||
eprintln!("\x1b[33;1mWARN \x1b[0m {}", format!($($arg)*));
|
||||
})
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! info {
|
||||
($($arg:tt)*) => ({
|
||||
println!("\x1b[38:5:86mINFO \x1b[0m {}", format!($($arg)*));
|
||||
println!("\x1b[36;1mINFO \x1b[0m {}", format!($($arg)*));
|
||||
})
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! debug {
|
||||
($($arg:tt)*) => ({
|
||||
println!("\x1b[38:5:63mDEBUG \x1b[0m {}", format!($($arg)*));
|
||||
($debg:expr, $($arg:tt)*) => ({
|
||||
if $debg {
|
||||
println!("\x1b[35;1mDEBUG \x1b[0m {}", format!($($arg)*));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -66,4 +66,4 @@ mod tests {
|
||||
assert_eq!(split("docker.example.com:5000/examplerepo/alpine:latest"), (String::from("docker.example.com:5000"), String::from("examplerepo/alpine"), String::from("latest")));
|
||||
assert_eq!(split("portainer/portainer:latest"), (String::from(DEFAULT_REGISTRY), String::from("portainer/portainer"), String::from("latest")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user