Skip to content

Commit

Permalink
Fix compilation error on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
spenserblack committed Oct 17, 2019
1 parent 1ba0286 commit 0264b7c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Expand Up @@ -17,4 +17,6 @@ bytecount = "0.5.1"
clap = "2.33.0"
strum = "0.16.0"
strum_macros = "0.16.0"
ansi_term = "0.12"

[target.'cfg(windows)'.dependencies]
ansi_term = "0.12"
15 changes: 13 additions & 2 deletions src/main.rs
Expand Up @@ -3,13 +3,15 @@ extern crate colored;
extern crate git2;
extern crate license;
extern crate tokei;
extern crate ansi_term;
#[macro_use]
extern crate clap;
extern crate strum;
#[macro_use]
extern crate strum_macros;

#[cfg(target = "windows")]
extern crate ansi_term;

use colored::Color;
use colored::*;
use git2::{Repository, Oid};
Expand Down Expand Up @@ -446,9 +448,18 @@ impl fmt::Display for Language {
}

fn main() -> Result<()> {
if cfg!(windows) && !ansi_term::enable_ansi_support().is_ok() {

#[cfg(target = "windows")]
let enabled = ansi_term::enable_ansi_support().is_ok();

#[cfg(not(target = "windows"))]
let enabled = true;

if !enabled {
colored::control::set_override(false);
}


if !is_git_installed() {
return Err(Error::GitNotInstalled);
}
Expand Down

0 comments on commit 0264b7c

Please sign in to comment.