diff --git a/Cargo.toml b/Cargo.toml index 3cb83f4..0e70d94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,8 +25,6 @@ zip = "0.5.11" # Dependency from workspace oof = { path = "./oof" } -[target.'cfg(unix)'.dependencies] -termion = "1.5.6" [profile.release] lto = true codegen-units = 1 diff --git a/src/lib.rs b/src/lib.rs index fa9bad7..70fc347 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,6 +10,7 @@ mod error; mod extension; mod file; mod utils; +mod test; pub use error::{Error, Result}; diff --git a/src/test.rs b/src/test.rs index 4d61540..95700a0 100644 --- a/src/test.rs +++ b/src/test.rs @@ -126,7 +126,7 @@ mod argparsing { #[cfg(test)] mod byte_pretty_printing { - use crate::bytes::Bytes; + use crate::utils::Bytes; #[test] fn bytes() { assert_eq!(&format!("{}", Bytes::new(234)), "234.00 B"); diff --git a/src/utils.rs b/src/utils.rs index 3afc693..99020aa 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -131,37 +131,35 @@ pub struct Bytes { #[allow(dead_code)] #[cfg(target_family = "unix")] pub mod colors { - use termion::color::*; - - pub fn reset() -> &'static str { - Reset.fg_str() + pub const fn reset() -> &'static str { + "\u{1b}[39m" } - pub fn black() -> &'static str { - LightBlack.fg_str() + pub const fn black() -> &'static str { + "\u{1b}[38;5;8m" } - pub fn blue() -> &'static str { - LightBlue.fg_str() + pub const fn blue() -> &'static str { + "\u{1b}[38;5;12m" } - pub fn cyan() -> &'static str { - LightCyan.fg_str() + pub const fn cyan() -> &'static str { + "\u{1b}[38;5;14m" } - pub fn green() -> &'static str { - LightGreen.fg_str() + pub const fn green() -> &'static str { + "\u{1b}[38;5;10m" } - pub fn magenta() -> &'static str { - LightMagenta.fg_str() + pub const fn magenta() -> &'static str { + "\u{1b}[38;5;13m" } - pub fn red() -> &'static str { - LightRed.fg_str() + pub const fn red() -> &'static str { + "\u{1b}[38;5;9m" } - pub fn white() -> &'static str { - LightWhite.fg_str() + pub const fn white() -> &'static str { + "\u{1b}[38;5;15m" } - pub fn yellow() -> &'static str { - LightYellow.fg_str() + pub const fn yellow() -> &'static str { + "\u{1b}[38;5;11m" } } -// Termion does not support Windows +// Windows does not support ANSI escape codes #[allow(dead_code, non_upper_case_globals)] #[cfg(not(target_family = "unix"))] pub mod colors {