Merge pull request #860 from AleoHQ/windows-colors-cli

[CLI] Adds colors to Windows cmd
This commit is contained in:
Collin Chin 2021-04-13 17:31:43 -07:00 committed by GitHub
commit 93493a467b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

1
Cargo.lock generated
View File

@ -1352,6 +1352,7 @@ dependencies = [
name = "leo-lang"
version = "1.3.0"
dependencies = [
"ansi_term 0.12.1",
"anyhow",
"clap",
"colored",

View File

@ -150,6 +150,10 @@ features = [ "fmt" ]
[dependencies.zip]
version = "0.5"
# add ansi support for Windows builds
[target.'cfg(windows)'.dependencies.ansi_term]
version = "0.12.1"
[dev-dependencies.rusty-hook]
version = "0.11.2"

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.