Fix colors on windows

* Initialize ansi_term if we're on windows
* Silence build warning on non-unix targets
* Update ansi-term which has windows specific fixes (and assert_cli while I'm at it)
This commit is contained in:
Adam Lesperance
2019-12-27 13:33:20 -06:00
committed by andy.boot
parent da61b15715
commit 38938e005e
2 changed files with 10 additions and 0 deletions
+9
View File
@@ -11,7 +11,16 @@ mod utils;
static DEFAULT_NUMBER_OF_LINES: usize = 20;
#[cfg(windows)]
fn init_color() {
ansi_term::enable_ansi_support().expect("Couldn't enable color support");
}
#[cfg(not(windows))]
fn init_color() {}
fn main() {
init_color();
let def_num_str = DEFAULT_NUMBER_OF_LINES.to_string();
let options = App::new("Dust")
.about("Like du but more intuitive")
+1
View File
@@ -1,5 +1,6 @@
use jwalk::DirEntry;
#[cfg(target_family = "unix")]
fn get_block_size() -> u64 {
// All os specific implementations of MetatdataExt seem to define a block as 512 bytes
// https://doc.rust-lang.org/std/os/linux/fs/trait.MetadataExt.html#tymethod.st_blocks