mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 11:35:45 +00:00
Drop dependency on Termion
This commit is contained in:
parent
0026e4d4de
commit
d9b39706e2
@ -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
|
||||
|
@ -10,6 +10,7 @@ mod error;
|
||||
mod extension;
|
||||
mod file;
|
||||
mod utils;
|
||||
mod test;
|
||||
|
||||
pub use error::{Error, Result};
|
||||
|
||||
|
@ -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");
|
||||
|
40
src/utils.rs
40
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user