mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-08 04:25:31 +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
|
# 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
|
||||||
|
@ -10,6 +10,7 @@ mod error;
|
|||||||
mod extension;
|
mod extension;
|
||||||
mod file;
|
mod file;
|
||||||
mod utils;
|
mod utils;
|
||||||
|
mod test;
|
||||||
|
|
||||||
pub use error::{Error, Result};
|
pub use error::{Error, Result};
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ mod argparsing {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod byte_pretty_printing {
|
mod byte_pretty_printing {
|
||||||
use crate::bytes::Bytes;
|
use crate::utils::Bytes;
|
||||||
#[test]
|
#[test]
|
||||||
fn bytes() {
|
fn bytes() {
|
||||||
assert_eq!(&format!("{}", Bytes::new(234)), "234.00 B");
|
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)]
|
#[allow(dead_code)]
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
pub mod colors {
|
pub mod colors {
|
||||||
use termion::color::*;
|
pub const fn reset() -> &'static str {
|
||||||
|
"\u{1b}[39m"
|
||||||
pub fn reset() -> &'static str {
|
|
||||||
Reset.fg_str()
|
|
||||||
}
|
}
|
||||||
pub fn black() -> &'static str {
|
pub const fn black() -> &'static str {
|
||||||
LightBlack.fg_str()
|
"\u{1b}[38;5;8m"
|
||||||
}
|
}
|
||||||
pub fn blue() -> &'static str {
|
pub const fn blue() -> &'static str {
|
||||||
LightBlue.fg_str()
|
"\u{1b}[38;5;12m"
|
||||||
}
|
}
|
||||||
pub fn cyan() -> &'static str {
|
pub const fn cyan() -> &'static str {
|
||||||
LightCyan.fg_str()
|
"\u{1b}[38;5;14m"
|
||||||
}
|
}
|
||||||
pub fn green() -> &'static str {
|
pub const fn green() -> &'static str {
|
||||||
LightGreen.fg_str()
|
"\u{1b}[38;5;10m"
|
||||||
}
|
}
|
||||||
pub fn magenta() -> &'static str {
|
pub const fn magenta() -> &'static str {
|
||||||
LightMagenta.fg_str()
|
"\u{1b}[38;5;13m"
|
||||||
}
|
}
|
||||||
pub fn red() -> &'static str {
|
pub const fn red() -> &'static str {
|
||||||
LightRed.fg_str()
|
"\u{1b}[38;5;9m"
|
||||||
}
|
}
|
||||||
pub fn white() -> &'static str {
|
pub const fn white() -> &'static str {
|
||||||
LightWhite.fg_str()
|
"\u{1b}[38;5;15m"
|
||||||
}
|
}
|
||||||
pub fn yellow() -> &'static str {
|
pub const fn yellow() -> &'static str {
|
||||||
LightYellow.fg_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)]
|
#[allow(dead_code, non_upper_case_globals)]
|
||||||
#[cfg(not(target_family = "unix"))]
|
#[cfg(not(target_family = "unix"))]
|
||||||
pub mod colors {
|
pub mod colors {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user