Fix colors on windows

This commit is contained in:
FliegendeWurst 2021-04-19 11:15:55 +02:00
parent e397ecf73b
commit dd37cc9d91
3 changed files with 6 additions and 3 deletions

View File

@ -19,7 +19,7 @@ $ cargo install --all-features --path .
## Usage ## Usage
First, open a terminal (use Powershell on Windows). First, open a terminal. Navigate to the directory that contains the downloaded binary.
Use `-o <directory>` to specify the download directory: Use `-o <directory>` to specify the download directory:
@ -78,7 +78,8 @@ OPTIONS:
### Credentials ### 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 [...] $ KIT-ILIAS-downloader -U uabcd --keyring [...]
``` ```

View File

@ -6,5 +6,5 @@ strip target/release/KIT-ILIAS-downloader
rustup target add x86_64-pc-windows-gnu rustup target add x86_64-pc-windows-gnu
# if on Debian or similar # if on Debian or similar
sudo apt install mingw-w64 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 strip target/x86_64-pc-windows-gnu/release/KIT-ILIAS-downloader

View File

@ -81,6 +81,8 @@ macro_rules! error {
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
let mut opt = Opt::from_args(); let mut opt = Opt::from_args();
#[cfg(windows)]
colored::control::set_virtual_terminal(true);
// use UNC paths on Windows // use UNC paths on Windows
opt.output = fs::canonicalize(opt.output).await.expect("failed to canonicalize directory"); opt.output = fs::canonicalize(opt.output).await.expect("failed to canonicalize directory");
LOG_LEVEL.store(opt.verbose, Ordering::SeqCst); LOG_LEVEL.store(opt.verbose, Ordering::SeqCst);