mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
Refactor: init_color function
Refactor function so windows & linux are forced to have same signature instead of 2 different functions
This commit is contained in:
+6
-5
@@ -31,13 +31,9 @@ mod utils;
|
|||||||
static DEFAULT_NUMBER_OF_LINES: usize = 30;
|
static DEFAULT_NUMBER_OF_LINES: usize = 30;
|
||||||
static DEFAULT_TERMINAL_WIDTH: usize = 80;
|
static DEFAULT_TERMINAL_WIDTH: usize = 80;
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
|
||||||
fn init_color(no_color: bool) -> bool {
|
fn init_color(no_color: bool) -> bool {
|
||||||
no_color
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn init_color(no_color: bool) -> bool {
|
{
|
||||||
// If no color is already set do not print a warning message
|
// If no color is already set do not print a warning message
|
||||||
if no_color {
|
if no_color {
|
||||||
true
|
true
|
||||||
@@ -55,6 +51,11 @@ fn init_color(no_color: bool) -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
{
|
||||||
|
no_color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn get_height_of_terminal() -> usize {
|
fn get_height_of_terminal() -> usize {
|
||||||
// Simplify once https://github.com/eminence/terminal-size/pull/41 is
|
// Simplify once https://github.com/eminence/terminal-size/pull/41 is
|
||||||
|
|||||||
Reference in New Issue
Block a user