adds colors to Windows CLI

This commit is contained in:
damirka 2021-04-13 20:18:11 +03:00
parent fc3c45e056
commit 2a9ed0b432
2 changed files with 4 additions and 3 deletions

View File

@ -202,6 +202,10 @@ where
/// Initialize logger with custom format and verbosity.
pub fn init_logger(_app_name: &'static str, verbosity: usize) {
// This line enables Windows 10 ANSI coloring API.
#[cfg(target_family = "windows")]
ansi_term::enable_ansi_support();
let subscriber = FmtSubscriber::builder()
// all spans/events with a level higher than TRACE (e.g, debug, info, warn, etc.)
// will be written to stdout.

View File

@ -178,9 +178,6 @@ enum CommandOpts {
}
fn main() {
#[cfg(target_family = "windows")]
ansi_term::enable_ansi_support();
// Read command line arguments.
let opt = Opt::from_args();