mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 20:15:27 +00:00
Fixing Windows build: no termion support
This commit is contained in:
parent
df1bc879cb
commit
bb004dc78c
@ -14,7 +14,6 @@ description = "A command-line utility for easily compressing and decompressing f
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
colored = "2.0.0"
|
colored = "2.0.0"
|
||||||
termion = "1.5.6"
|
|
||||||
walkdir = "2.3.2"
|
walkdir = "2.3.2"
|
||||||
tar = "0.4.33"
|
tar = "0.4.33"
|
||||||
xz2 = "0.1.6"
|
xz2 = "0.1.6"
|
||||||
@ -25,6 +24,8 @@ zip = "0.5.11"
|
|||||||
# Dependency from workspace
|
# Dependency from workspace
|
||||||
oof = { path = "./oof" }
|
oof = { path = "./oof" }
|
||||||
|
|
||||||
|
[target.'cfg(unix)'.dependencies]
|
||||||
|
termion = "1.5.6"
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
|
20
src/utils.rs
20
src/utils.rs
@ -126,7 +126,9 @@ pub struct Bytes {
|
|||||||
bytes: f64,
|
bytes: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
/// Module with a list of bright colors.
|
||||||
|
#[allow(dead_code, non_upper_case_globals)]
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
pub mod colors {
|
pub mod colors {
|
||||||
use termion::color::*;
|
use termion::color::*;
|
||||||
|
|
||||||
@ -158,6 +160,22 @@ pub mod colors {
|
|||||||
LightYellow.fg_str()
|
LightYellow.fg_str()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Termion does not support Windows
|
||||||
|
#[cfg(not(target_family = "unix"))]
|
||||||
|
pub mod colors {
|
||||||
|
pub fn empty() -> &'static str {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
pub const reset: fn() -> &'static str = empty;
|
||||||
|
pub const black: fn() -> &'static str = empty;
|
||||||
|
pub const blue: fn() -> &'static str = empty;
|
||||||
|
pub const cyan: fn() -> &'static str = empty;
|
||||||
|
pub const green: fn() -> &'static str = empty;
|
||||||
|
pub const magenta: fn() -> &'static str = empty;
|
||||||
|
pub const red: fn() -> &'static str = empty;
|
||||||
|
pub const white: fn() -> &'static str = empty;
|
||||||
|
pub const yellow: fn() -> &'static str = empty;
|
||||||
|
}
|
||||||
|
|
||||||
impl Bytes {
|
impl Bytes {
|
||||||
const UNIT_PREFIXES: [&'static str; 6] = ["", "k", "M", "G", "T", "P"];
|
const UNIT_PREFIXES: [&'static str; 6] = ["", "k", "M", "G", "T", "P"];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user