From 6c064a1dd84e039ea2a971d5c82992474bf4e026 Mon Sep 17 00:00:00 2001 From: Dennis Ranke Date: Mon, 28 Mar 2022 22:29:45 +0200 Subject: [PATCH] enable ansi terminal on windows 10 cmd --- Cargo.lock | 1 + Cargo.toml | 3 ++- src/main.rs | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index e17b649..02c0735 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2332,6 +2332,7 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" name = "uw8" version = "0.1.2" dependencies = [ + "ansi_term", "anyhow", "curlywas", "minifb", diff --git a/Cargo.toml b/Cargo.toml index 4ea7539..cd82124 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,4 +23,5 @@ same-file = "1" warp = { version = "0.3.2", optional = true } tokio = { version = "1.17.0", features = ["sync", "rt"], optional = true } tokio-stream = { version = "0.1.8", features = ["sync"], optional = true } -webbrowser = { version = "0.6.0", optional = true } \ No newline at end of file +webbrowser = { version = "0.6.0", optional = true } +ansi_term = "0.12.1" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 71d03f2..b304112 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,9 @@ use uw8::Runtime; fn main() -> Result<()> { let mut args = Arguments::from_env(); + // try to enable ansi support in win10 cmd shell + let _ = ansi_term::enable_ansi_support(); + match args.subcommand()?.as_deref() { Some("version") => { println!("{}", env!("CARGO_PKG_VERSION"));