Skip to content

Commit

Permalink
Add Windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
lzybkr authored and sharkdp committed Aug 25, 2019
1 parent 8b0ba62 commit 714baac
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ exclude = ["doc/pastel.gif"]
lazy_static = "1.3.0"
rand = "0.7"
atty = "0.2"
output_vt100 = "0.1"

# binary-only dependencies (see https://github.com/rust-lang/cargo/issues/1982)
regex = "1"
Expand Down
10 changes: 10 additions & 0 deletions src/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ fn run() -> Result<ExitCode> {

let interactive_mode = atty::is(Stream::Stdout);

if interactive_mode {
output_vt100::init();
}

let color_mode = match global_matches
.value_of("color-mode")
.expect("required argument")
Expand All @@ -55,6 +59,12 @@ fn run() -> Result<ExitCode> {
Some(value) => {
return Err(PastelError::UnknownColorMode(value.into()));
}
#[cfg(windows)]
None => {
// Assume 24bit support on Windows
Some(ansi::Mode::TrueColor)
}
#[cfg(not(windows))]
None => {
let env_colorterm = std::env::var("COLORTERM").ok();
match env_colorterm.as_ref().map(|s| s.as_str()) {
Expand Down

0 comments on commit 714baac

Please sign in to comment.