diff options
author | Himbeer <himbeer@disroot.org> | 2025-03-25 11:15:00 +0100 |
---|---|---|
committer | Himbeer <himbeer@disroot.org> | 2025-03-25 11:15:00 +0100 |
commit | 097ba29d8cb4a1930dd60302783892b90a7d927c (patch) | |
tree | 90f8ad85b3258cd52340e405bc3c3df003e77a12 | |
parent | 20cee7ffac3c4486b4fc5f19fd27e508be4aa3c5 (diff) |
Remove termcolor dependency
-rw-r--r-- | Cargo.lock | 21 | ||||
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | src/main.rs | 27 |
3 files changed, 3 insertions, 46 deletions
@@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -198,7 +198,6 @@ dependencies = [ "nix", "sys-mount", "sysinfo", - "termcolor", "tokio", ] @@ -272,15 +271,6 @@ dependencies = [ ] [[package]] -name = "termcolor" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" -dependencies = [ - "winapi-util", -] - -[[package]] name = "thiserror" version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -387,15 +377,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] - -[[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -10,5 +10,4 @@ humantime = "2.1.0" nix = { version = "0.27.1", features = ["reboot", "fs"] } sys-mount = { version = "2.0.2", default-features = false } sysinfo = { version = "0.29.10", default-features = false } -termcolor = "1.1.3" tokio = { version = "1.0", features = ["signal", "macros", "rt-multi-thread"] } diff --git a/src/main.rs b/src/main.rs index 41ba816..08af1d6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,28 +10,13 @@ use tokio::signal::unix::{signal, SignalKind}; use nix::sys::reboot::RebootMode; use sys_mount::{Mount, Unmount, UnmountDrop, UnmountFlags}; use sysinfo::{ProcessExt, Signal, System, SystemExt}; -use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; const SERVICE_RESTART_INTERVAL: Duration = Duration::from_secs(30); macro_rules! log { ($col:expr, $($tts:tt)*) => { { - let mut stdout = StandardStream::stdout(ColorChoice::Always); - - match stdout.set_color(ColorSpec::new().set_fg(Some($col))) { - Ok(_) => match write!(&mut stdout, $($tts)*) { - Ok(_) => { - stdout.reset().ok(); - match writeln!(&mut stdout) { - Ok(_) => {} - Err(_) => println!(), - } - } - Err(_) => println!($($tts)*), - } - Err(_) => println!($($tts)*), - } + println!($($tts)*); } }; } @@ -39,15 +24,7 @@ macro_rules! log { macro_rules! log_raw { ($col:expr, $($tts:tt)*) => { { - let mut stdout = StandardStream::stdout(ColorChoice::Always); - - match stdout.set_color(ColorSpec::new().set_fg(Some($col))) { - Ok(_) => match write!(&mut stdout, $($tts)*) { - Ok(_) => {} - Err(_) => print!($($tts)*), - } - Err(_) => print!($($tts)*), - } + print!($($tts)*); } }; } |