Quick changes
This commit is contained in:
35
Cargo.lock
generated
35
Cargo.lock
generated
@@ -54,6 +54,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"color-eyre",
|
||||
"quickcheck",
|
||||
"strum",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
@@ -129,6 +130,12 @@ version = "0.32.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "indenter"
|
||||
version = "0.3.4"
|
||||
@@ -286,6 +293,12 @@ version = "0.1.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d"
|
||||
|
||||
[[package]]
|
||||
name = "sharded-slab"
|
||||
version = "0.1.7"
|
||||
@@ -301,6 +314,28 @@ version = "1.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.27.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf"
|
||||
dependencies = [
|
||||
"strum_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.27.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.106"
|
||||
|
||||
@@ -6,6 +6,7 @@ edition = "2024"
|
||||
[dependencies]
|
||||
anyhow = "1.0.100"
|
||||
color-eyre = "0.6.5"
|
||||
strum = { version = "0.27.2", features = ["derive", "strum_macros"] }
|
||||
thiserror = "2.0.17"
|
||||
tracing = "0.1.41"
|
||||
tracing-subscriber = "0.3.20"
|
||||
|
||||
58
src/lib.rs
58
src/lib.rs
@@ -0,0 +1,58 @@
|
||||
use strum::Display;
|
||||
|
||||
// Terminal Colors
|
||||
#[allow(clippy::octal_escapes)]
|
||||
const CONTROL_PREFIX: &str = "\033[";
|
||||
const CONTROL_SUFFIX: &str = "m";
|
||||
|
||||
#[derive(Copy, Clone, Debug, Display, PartialEq, Eq, Hash)]
|
||||
pub enum AuxillaryAnsiCode {
|
||||
#[strum(to_string = "1")]
|
||||
Bold,
|
||||
#[strum(to_string = "4")]
|
||||
Underline
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Display, PartialEq, Eq, Hash)]
|
||||
pub enum AnsiColor {
|
||||
#[strum(to_string = "30")]
|
||||
Black = 30,
|
||||
#[strum(to_string = "31")]
|
||||
Red = 31,
|
||||
#[strum(to_string = "32")]
|
||||
Green = 32,
|
||||
#[strum(to_string = "33")]
|
||||
Yellow = 33,
|
||||
#[strum(to_string = "34")]
|
||||
Blue = 34,
|
||||
#[strum(to_string = "35")]
|
||||
Magent = 35,
|
||||
#[strum(to_string = "36")]
|
||||
Cyan = 36,
|
||||
#[strum(to_string = "37")]
|
||||
White = 37,
|
||||
#[strum(to_string = "90")]
|
||||
BrightBlack = 90,
|
||||
#[strum(to_string = "91")]
|
||||
BrightRed = 91,
|
||||
#[strum(to_string = "92")]
|
||||
BrightGreen = 92,
|
||||
#[strum(to_string = "93")]
|
||||
BrightYellow = 93,
|
||||
#[strum(to_string = "94")]
|
||||
BrightBlue = 94,
|
||||
#[strum(to_string = "95")]
|
||||
BrightMagent = 95,
|
||||
#[strum(to_string = "96")]
|
||||
BrightCyan = 96,
|
||||
#[strum(to_string = "97")]
|
||||
BrightWhit = 97,
|
||||
}
|
||||
|
||||
/// ANSI Control Codes for modifying font display in most terminals
|
||||
#[derive(Copy, Clone, Debug, Display, PartialEq, Eq, Hash)]
|
||||
pub enum AnsiCode {
|
||||
Reset,
|
||||
#[strum(to_string = "30")]
|
||||
FGColor(AnsiColor, Option<AuxillaryAnsiCode>, Option<AuxillaryAnsiCode>),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user