File tree 2 files changed +16
-3
lines changed
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -17,4 +17,6 @@ bytecount = "0.5.1"
17
17
clap = " 2.33.0"
18
18
strum = " 0.16.0"
19
19
strum_macros = " 0.16.0"
20
- ansi_term = " 0.12"
20
+
21
+ [target .'cfg(windows)' .dependencies ]
22
+ ansi_term = " 0.12"
Original file line number Diff line number Diff line change @@ -3,13 +3,15 @@ extern crate colored;
3
3
extern crate git2;
4
4
extern crate license;
5
5
extern crate tokei;
6
- extern crate ansi_term;
7
6
#[ macro_use]
8
7
extern crate clap;
9
8
extern crate strum;
10
9
#[ macro_use]
11
10
extern crate strum_macros;
12
11
12
+ #[ cfg( target = "windows" ) ]
13
+ extern crate ansi_term;
14
+
13
15
use colored:: Color ;
14
16
use colored:: * ;
15
17
use git2:: { Repository , Oid } ;
@@ -446,9 +448,18 @@ impl fmt::Display for Language {
446
448
}
447
449
448
450
fn main ( ) -> Result < ( ) > {
449
- if cfg ! ( windows) && !ansi_term:: enable_ansi_support ( ) . is_ok ( ) {
451
+
452
+ #[ cfg( target = "windows" ) ]
453
+ let enabled = ansi_term:: enable_ansi_support ( ) . is_ok ( ) ;
454
+
455
+ #[ cfg( not( target = "windows" ) ) ]
456
+ let enabled = true ;
457
+
458
+ if !enabled {
450
459
colored:: control:: set_override ( false ) ;
451
460
}
461
+
462
+
452
463
if !is_git_installed ( ) {
453
464
return Err ( Error :: GitNotInstalled ) ;
454
465
}
You can’t perform that action at this time.
0 commit comments