From dd37cc9d91662d51fa05769e6ca6d9ebd3ed0541 Mon Sep 17 00:00:00 2001 From: FliegendeWurst <2012gdwu+github@posteo.de> Date: Mon, 19 Apr 2021 11:15:55 +0200 Subject: [PATCH] Fix colors on windows --- README.md | 5 +++-- build.sh | 2 +- src/main.rs | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 68a86da..cc7b1d0 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ $ cargo install --all-features --path . ## Usage -First, open a terminal (use Powershell on Windows). +First, open a terminal. Navigate to the directory that contains the downloaded binary. Use `-o ` to specify the download directory: @@ -78,7 +78,8 @@ OPTIONS: ### Credentials -You can use the `--user` and `--keyring` options to get/store the password using the system password store: +You can use the `--user` and `--keyring` options to get/store the password using the system password store. +If you use Linux, you'll have to compile from source to be able to use this option. ``` $ KIT-ILIAS-downloader -U uabcd --keyring [...] ``` diff --git a/build.sh b/build.sh index 0308c49..bf6e62b 100755 --- a/build.sh +++ b/build.sh @@ -6,5 +6,5 @@ strip target/release/KIT-ILIAS-downloader rustup target add x86_64-pc-windows-gnu # if on Debian or similar sudo apt install mingw-w64 -cargo build --release --target x86_64-pc-windows-gnu +cargo build --release --all-features --target x86_64-pc-windows-gnu strip target/x86_64-pc-windows-gnu/release/KIT-ILIAS-downloader diff --git a/src/main.rs b/src/main.rs index b51f4d1..9d103ee 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,6 +81,8 @@ macro_rules! error { #[tokio::main] async fn main() { let mut opt = Opt::from_args(); + #[cfg(windows)] + colored::control::set_virtual_terminal(true); // use UNC paths on Windows opt.output = fs::canonicalize(opt.output).await.expect("failed to canonicalize directory"); LOG_LEVEL.store(opt.verbose, Ordering::SeqCst);