diff --git a/Cargo.lock b/Cargo.lock index 6eebe01..42aeb4e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,16 +18,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] -name = "adler2" -version = "2.0.0" +name = "aho-corasick" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - -[[package]] -name = "aligned-vec" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] [[package]] name = "allocator-api2" @@ -35,30 +32,6 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anstream" version = "0.6.18" @@ -109,41 +82,12 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "anyhow" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" - -[[package]] -name = "arbitrary" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" - -[[package]] -name = "arg_enum_proc_macro" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "arraydeque" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" -[[package]] -name = "arrayvec" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" - [[package]] name = "async-trait" version = "0.1.88" @@ -161,29 +105,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[package]] -name = "av1-grain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6678909d8c5d46a42abcf571271e15fdbc0a225e3646cf23762cd415046c78bf" -dependencies = [ - "anyhow", - "arrayvec", - "log", - "nom", - "num-rational", - "v_frame", -] - -[[package]] -name = "avif-serialize" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98922d6a4cfbcb08820c69d8eeccc05bb1f29bfa06b4f5b1dbfe9a868bd7608e" -dependencies = [ - "arrayvec", -] - [[package]] name = "backtrace" version = "0.3.71" @@ -194,7 +115,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide 0.7.4", + "miniz_oxide", "object", "rustc-demangle", ] @@ -205,18 +126,6 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" -[[package]] -name = "bit_field" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bitflags" version = "2.9.0" @@ -226,12 +135,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bitstream-io" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6099cdc01846bc367c4e7dd630dc5966dccf36b652fae7a74e17b640411a91b2" - [[package]] name = "block-buffer" version = "0.10.4" @@ -241,36 +144,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "built" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ed6191a7e78c36abdb16ab65341eefd73d64d303fffccdbb00d51e4205967b" - -[[package]] -name = "bumpalo" -version = "3.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" - -[[package]] -name = "bytemuck" -version = "1.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "byteorder-lite" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" - [[package]] name = "cassowary" version = "0.3.0" @@ -292,41 +165,15 @@ version = "1.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04da6a0d40b948dfc4fa8f5bbf402b0fc1a64a28dbf7d12ffd683550f2c1b63a" dependencies = [ - "jobserver", - "libc", "shlex", ] -[[package]] -name = "cfg-expr" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" -dependencies = [ - "smallvec", - "target-lexicon", -] - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chrono" -version = "0.4.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-link", -] - [[package]] name = "clap" version = "4.5.37" @@ -334,7 +181,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071" dependencies = [ "clap_builder", - "clap_derive", ] [[package]] @@ -349,18 +195,6 @@ dependencies = [ "strsim", ] -[[package]] -name = "clap_derive" -version = "4.5.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "clap_lex" version = "0.7.4" @@ -394,27 +228,12 @@ dependencies = [ "tracing-error", ] -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - [[package]] name = "colorchoice" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" -[[package]] -name = "colored" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "compact_str" version = "0.8.1" @@ -463,7 +282,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" dependencies = [ - "getrandom 0.2.16", + "getrandom", "once_cell", "tiny-keccak", ] @@ -477,12 +296,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - [[package]] name = "cpufeatures" version = "0.2.17" @@ -493,29 +306,10 @@ dependencies = [ ] [[package]] -name = "crc32fast" -version = "1.4.2" +name = "crossbeam-channel" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" dependencies = [ "crossbeam-utils", ] @@ -532,7 +326,7 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ - "bitflags 2.9.0", + "bitflags", "crossterm_winapi", "mio", "parking_lot", @@ -602,6 +396,15 @@ dependencies = [ "syn", ] +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +dependencies = [ + "powerfmt", +] + [[package]] name = "digest" version = "0.10.7" @@ -673,21 +476,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "exr" -version = "1.73.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83197f59927b46c04a183a619b7c29df34e63e63c7869320862268c0ef687e0" -dependencies = [ - "bit_field", - "half", - "lebe", - "miniz_oxide 0.8.8", - "rayon-core", - "smallvec", - "zune-inflate", -] - [[package]] name = "eyre" version = "0.6.12" @@ -698,31 +486,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "fdeflate" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "flate2" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" -dependencies = [ - "crc32fast", - "miniz_oxide 0.8.8", -] - -[[package]] -name = "fmt" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09904adae26440d46daeacb5ed7922fee69d43ebf84d31e078cd49652cecd718" - [[package]] name = "fnv" version = "1.0.7" @@ -753,29 +516,7 @@ checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "wasi 0.14.2+wasi-0.2.4", -] - -[[package]] -name = "gif" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2" -dependencies = [ - "color_quant", - "weezl", + "wasi", ] [[package]] @@ -784,16 +525,6 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" -[[package]] -name = "half" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" -dependencies = [ - "cfg-if", - "crunchy", -] - [[package]] name = "hashbrown" version = "0.14.5" @@ -826,93 +557,12 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "iana-time-zone" -version = "0.1.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - [[package]] name = "ident_case" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "image" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" -dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "exr", - "gif", - "jpeg-decoder", - "num-traits", - "png", - "qoi", - "tiff", -] - -[[package]] -name = "image" -version = "0.25.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db35664ce6b9810857a38a906215e75a9c879f0696556a39f59c62829710251a" -dependencies = [ - "bytemuck", - "byteorder-lite", - "color_quant", - "exr", - "gif", - "image-webp", - "num-traits", - "png", - "qoi", - "ravif", - "rayon", - "rgb", - "tiff", - "zune-core", - "zune-jpeg", -] - -[[package]] -name = "image-webp" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b77d01e822461baa8409e156015a1d91735549f0f2c17691bd2d996bef238f7f" -dependencies = [ - "byteorder-lite", - "quick-error", -] - -[[package]] -name = "imgref" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408" - [[package]] name = "indenter" version = "0.3.3" @@ -948,32 +598,12 @@ dependencies = [ "syn", ] -[[package]] -name = "interpolate_name" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "is_terminal_polyfill" version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.13.0" @@ -989,35 +619,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" -[[package]] -name = "jobserver" -version = "0.1.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" -dependencies = [ - "getrandom 0.3.2", - "libc", -] - -[[package]] -name = "jpeg-decoder" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" -dependencies = [ - "rayon", -] - -[[package]] -name = "js-sys" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - [[package]] name = "json5" version = "0.4.1" @@ -1035,35 +636,19 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -[[package]] -name = "lebe" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" - [[package]] name = "libc" version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" -[[package]] -name = "libfuzzer-sys" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf78f52d400cf2d84a3a973a78a592b4adc535739e0a5597a0da6f0c357adc75" -dependencies = [ - "arbitrary", - "cc", -] - [[package]] name = "libredox" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.9.0", + "bitflags", "libc", ] @@ -1089,15 +674,6 @@ version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" -[[package]] -name = "loop9" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" -dependencies = [ - "imgref", -] - [[package]] name = "lru" version = "0.12.5" @@ -1108,34 +684,29 @@ dependencies = [ ] [[package]] -name = "maybe-rayon" -version = "0.1.1" +name = "matchers" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "cfg-if", - "rayon", + "regex-automata 0.1.10", ] [[package]] name = "mcl" version = "0.1.0" dependencies = [ - "chrono", "clap", "color-eyre", - "colored", "config", "crossterm", "dirs-next", - "fmt", - "image 0.25.6", - "lazy_static", "once_cell", - "rascii_art", "ratatui", "serde", - "serde_derive", + "tracing", + "tracing-appender", + "tracing-subscriber", ] [[package]] @@ -1144,12 +715,6 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.7.4" @@ -1159,16 +724,6 @@ dependencies = [ "adler", ] -[[package]] -name = "miniz_oxide" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" -dependencies = [ - "adler2", - "simd-adler32", -] - [[package]] name = "mio" version = "1.0.3" @@ -1177,81 +732,25 @@ checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys 0.52.0", ] [[package]] -name = "new_debug_unreachable" -version = "1.0.6" +name = "nu-ansi-term" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" dependencies = [ - "memchr", - "minimal-lexical", + "overload", + "winapi", ] [[package]] -name = "noop_proc_macro" -version = "0.3.0" +name = "num-conv" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "object" @@ -1278,6 +777,12 @@ dependencies = [ "hashbrown 0.14.5", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "owo-colors" version = "3.5.0" @@ -1371,32 +876,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] -name = "pkg-config" -version = "0.3.32" +name = "powerfmt" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" - -[[package]] -name = "png" -version = "0.17.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" -dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide 0.8.8", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "proc-macro2" @@ -1407,40 +890,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "profiling" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" -dependencies = [ - "profiling-procmacros", -] - -[[package]] -name = "profiling-procmacros" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "qoi" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - [[package]] name = "quote" version = "1.0.40" @@ -1450,67 +899,19 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "r-efi" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.16", -] - -[[package]] -name = "rascii_art" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e27f573a36aab4d4f2dd4aae8f44e8c5409a3d2cefce01d116cb11de546b1c65" -dependencies = [ - "ansi_term", - "clap", - "image 0.24.9", - "unicode-segmentation", -] - [[package]] name = "ratatui" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b" dependencies = [ - "bitflags 2.9.0", + "bitflags", "cassowary", "compact_str", "crossterm", "indoc", "instability", - "itertools 0.13.0", + "itertools", "lru", "paste", "strum", @@ -1519,83 +920,13 @@ dependencies = [ "unicode-width 0.2.0", ] -[[package]] -name = "rav1e" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd87ce80a7665b1cce111f8a16c1f3929f6547ce91ade6addf4ec86a8dda5ce9" -dependencies = [ - "arbitrary", - "arg_enum_proc_macro", - "arrayvec", - "av1-grain", - "bitstream-io", - "built", - "cfg-if", - "interpolate_name", - "itertools 0.12.1", - "libc", - "libfuzzer-sys", - "log", - "maybe-rayon", - "new_debug_unreachable", - "noop_proc_macro", - "num-derive", - "num-traits", - "once_cell", - "paste", - "profiling", - "rand", - "rand_chacha", - "simd_helpers", - "system-deps", - "thiserror 1.0.69", - "v_frame", - "wasm-bindgen", -] - -[[package]] -name = "ravif" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6a5f31fcf7500f9401fea858ea4ab5525c99f2322cfcee732c0e6c74208c0c6" -dependencies = [ - "avif-serialize", - "imgref", - "loop9", - "quick-error", - "rav1e", - "rayon", - "rgb", -] - -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - [[package]] name = "redox_syscall" version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2f103c6d277498fbceb16e84d317e2a400f160f46904d5f5410848c829511a3" dependencies = [ - "bitflags 2.9.0", + "bitflags", ] [[package]] @@ -1604,16 +935,54 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ - "getrandom 0.2.16", + "getrandom", "libredox", "thiserror 1.0.69", ] [[package]] -name = "rgb" -version = "0.8.50" +name = "regex" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.14", + "regex-syntax 0.8.10", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.10", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "ron" @@ -1622,7 +991,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" dependencies = [ "base64", - "bitflags 2.9.0", + "bitflags", "serde", "serde_derive", ] @@ -1650,7 +1019,7 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.9.0", + "bitflags", "errno", "libc", "linux-raw-sys", @@ -1772,21 +1141,6 @@ dependencies = [ "libc", ] -[[package]] -name = "simd-adler32" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" - -[[package]] -name = "simd_helpers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" -dependencies = [ - "quote", -] - [[package]] name = "smallvec" version = "1.15.0" @@ -1838,25 +1192,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "system-deps" -version = "6.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" -dependencies = [ - "cfg-expr", - "heck", - "pkg-config", - "toml", - "version-compare", -] - -[[package]] -name = "target-lexicon" -version = "0.12.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" - [[package]] name = "thiserror" version = "1.0.69" @@ -1908,14 +1243,34 @@ dependencies = [ ] [[package]] -name = "tiff" -version = "0.9.1" +name = "time" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" dependencies = [ - "flate2", - "jpeg-decoder", - "weezl", + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" + +[[package]] +name = "time-macros" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +dependencies = [ + "num-conv", + "time-core", ] [[package]] @@ -1968,9 +1323,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-appender" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786d480bce6247ab75f005b14ae1624ad978d3029d9113f0a22fa1ac773faeaf" +dependencies = [ + "crossbeam-channel", + "thiserror 2.0.12", + "time", + "tracing-subscriber", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tracing-core" version = "0.1.33" @@ -1991,15 +1370,33 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + [[package]] name = "tracing-subscriber" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", "sharded-slab", + "smallvec", "thread_local", + "tracing", "tracing-core", + "tracing-log", ] [[package]] @@ -2038,7 +1435,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" dependencies = [ - "itertools 0.13.0", + "itertools", "unicode-segmentation", "unicode-width 0.1.14", ] @@ -2061,29 +1458,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" -[[package]] -name = "v_frame" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f32aaa24bacd11e488aa9ba66369c7cd514885742c9fe08cfe85884db3e92b" -dependencies = [ - "aligned-vec", - "num-traits", - "wasm-bindgen", -] - [[package]] name = "valuable" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" -[[package]] -name = "version-compare" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" - [[package]] name = "version_check" version = "0.9.5" @@ -2096,79 +1476,6 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" -dependencies = [ - "wit-bindgen-rt", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "weezl" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" - [[package]] name = "winapi" version = "0.3.9" @@ -2191,65 +1498,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-core" -version = "0.61.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link", - "windows-result", - "windows-strings", -] - -[[package]] -name = "windows-implement" -version = "0.60.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "windows-interface" -version = "0.59.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "windows-link" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" - -[[package]] -name = "windows-result" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-strings" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97" -dependencies = [ - "windows-link", -] - [[package]] name = "windows-sys" version = "0.52.0" @@ -2341,15 +1589,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "wit-bindgen-rt" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags 2.9.0", -] - [[package]] name = "yaml-rust2" version = "0.10.1" @@ -2360,47 +1599,3 @@ dependencies = [ "encoding_rs", "hashlink", ] - -[[package]] -name = "zerocopy" -version = "0.8.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zune-core" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" - -[[package]] -name = "zune-inflate" -version = "0.2.54" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "zune-jpeg" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a5bab8d7dedf81405c4bb1f2b83ea057643d9cb28778cea9eecddeedd2e028" -dependencies = [ - "zune-core", -] diff --git a/Cargo.toml b/Cargo.toml index 538fa63..56d0741 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,14 +10,9 @@ color-eyre = "0.6.3" config = "0.15.6" crossterm = "0.28.1" dirs-next = "2.0.0" -ratatui = "0.29.0" -serde = { version = "1.0.217", features = ["derive"]} -serde_derive = "1.0.217" -lazy_static = "1.5.0" -colored = "3.0.0" -chrono = "0.4.39" -image = "0.25.5" -fmt = "0.1.0" once_cell = "1.20.3" -rascii_art = "0.4.5" - +ratatui = "0.29.0" +serde = { version = "1.0.217", features = ["derive"] } +tracing = "0.1" +tracing-appender = "0.2" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/repomix-output.xml b/repomix-output.xml deleted file mode 100644 index da81c5f..0000000 --- a/repomix-output.xml +++ /dev/null @@ -1,1196 +0,0 @@ -This file is a merged representation of the entire codebase, combined into a single document by Repomix. - - -This section contains a summary of this file. - - -This file contains a packed representation of the entire repository's contents. -It is designed to be easily consumable by AI systems for analysis, code review, -or other automated processes. - - - -The content is organized as follows: -1. This summary section -2. Repository information -3. Directory structure -4. Repository files (if enabled) -4. Repository files, each consisting of: - - File path as an attribute - - Full contents of the file - - - -- This file should be treated as read-only. Any changes should be made to the - original repository files, not this packed version. -- When processing this file, use the file path to distinguish - between different files in the repository. -- Be aware that this file may contain sensitive information. Handle it with - the same level of security as you would the original repository. - - - -- Some files may have been excluded based on .gitignore rules and Repomix's configuration -- Binary files are not included in this packed representation. Please refer to the Repository Structure section for a complete list of file paths, including binary files -- Files matching patterns in .gitignore are excluded -- Files matching default ignore patterns are excluded -- Files are sorted by Git change count (files with more changes are at the bottom) - - - - - - - - - -assets/ - default.toml -src/ - config/ - mod.rs - types.rs - tui/ - widgets/ - popups/ - base.rs - mod.rs - new_instance.rs - account.rs - content.rs - details.rs - mod.rs - profiles.rs - status.rs - layout.rs - mod.rs - cli.rs - logger.rs - macros.rs - main.rs -.gitignore -Cargo.toml - - - -This section contains the contents of the repository's files. - - -use ratatui::{ - buffer::Buffer, - layout::Rect, - style::Style, - text::Line, - widgets::{Block, Borders, Clear, Widget}, -}; - -pub struct Popup<'a> { - pub title: Line<'a>, - pub border_style: Style, - pub title_style: Style, - pub style: Style, - pub content: Box, -} - -impl<'a> Widget for Popup<'a> { - fn render(self, area: Rect, buf: &mut Buffer) { - Clear.render(area, buf); - - let block = Block::new() - .title(self.title) - .title_style(self.title_style) - .borders(Borders::ALL) - .border_style(self.border_style); - - let inner_area = block.inner(area); - block.render(area, buf); - - (self.content)(inner_area, buf); - } -} - - - -pub mod base; -pub mod new_instance; - - - -use super::base::Popup; -use crate::tui::layout::FocusedArea; -use crate::tui::widgets::profiles; -use crossterm::event::KeyCode; -use ratatui::{ - Frame, - layout::{Rect, Layout, Direction, Constraint}, - text::{Line, Span}, - widgets::{Block, Borders, Paragraph, Wrap, Widget}, -}; -use once_cell::sync::Lazy; -use std::sync::Mutex; - -static INSTANCE_POPUP_STATE: Lazy> = Lazy::new(|| Mutex::new(NewInstanceState::default())); - -#[derive(Debug, Default)] -enum NewInstanceMode { - #[default] - Buttons, - Input, -} - -#[derive(Debug, Default)] -struct NewInstanceState { - mode: NewInstanceMode, - input_text: String, -} - -pub fn render(frame: &mut Frame, area: Rect, _focused: FocusedArea) { - let state = INSTANCE_POPUP_STATE.lock().unwrap(); - - let popup = Popup { - title: Line::from("New Instance"), - content: Box::new(move |area, buf| { - match state.mode { - NewInstanceMode::Buttons => { - let chunks = Layout::default() - .direction(Direction::Vertical) - .constraints([ - Constraint::Percentage(40), - Constraint::Length(3), - Constraint::Length(3), - Constraint::Percentage(40), - ]) - .split(area); - - let create_button = Paragraph::new(Line::from(vec![ - Span::styled("[C]", ratatui::style::Style::default().add_modifier(ratatui::style::Modifier::BOLD)), - Span::raw("reate New Instance"), - ])).alignment(ratatui::layout::Alignment::Center); - - let import_button = Paragraph::new(Line::from(vec![ - Span::styled("[I]", ratatui::style::Style::default().add_modifier(ratatui::style::Modifier::BOLD)), - Span::raw("mport Morinth Modpack"), - ])).alignment(ratatui::layout::Alignment::Center); - - create_button.render(chunks[1], buf); - import_button.render(chunks[2], buf); - } - NewInstanceMode::Input => { - let paragraph = Paragraph::new(state.input_text.clone()) - .block(Block::default().title("Enter URL or Path").borders(Borders::ALL)) - .wrap(Wrap { trim: true }); - - paragraph.render(area, buf); - } - } - }), - border_style: Default::default(), - title_style: Default::default(), - style: Default::default(), - }; - - frame.render_widget(popup, area); -} - -pub fn handle_key(key_event: &crossterm::event::KeyEvent, state: &mut profiles::State) { - let mut popup_state = INSTANCE_POPUP_STATE.lock().unwrap(); - - match popup_state.mode { - NewInstanceMode::Buttons => { - match key_event.code { - KeyCode::Char('q') => { - state.show_popup = false; - } - KeyCode::Char('c') => { - // Create new instance - state.show_popup = false; - } - KeyCode::Char('i') => { - // Switch to input mode - popup_state.mode = NewInstanceMode::Input; - } - _ => {} - } - } - NewInstanceMode::Input => match key_event.code { - KeyCode::Esc => { - popup_state.mode = NewInstanceMode::Buttons; - } - KeyCode::Enter => { - // Confirm input - state.show_popup = false; - } - KeyCode::Char(c) => { - popup_state.input_text.push(c); - } - KeyCode::Backspace => { - popup_state.input_text.pop(); - } - _ => {} - }, - } -} - - - -use ratatui::{ - layout::Rect, - style::{Color, Style}, - widgets::{Block, BorderType, Borders, Paragraph}, - Frame, -}; - -use crate::tui::layout::FocusedArea; - -use super::styled_title; - -pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea) { - let color = if focused == FocusedArea::Account { - Color::White - } else { - Color::DarkGray - }; - - let block = Block::default() - .title(styled_title("Account", true)) - .borders(Borders::ALL) - .border_type(BorderType::Rounded) - .border_style(Style::default().fg(color)); - - let widget = Paragraph::new("TEST CONTENT").block(block); - frame.render_widget(widget, area); -} - - - -use ratatui::{ - layout::Rect, - style::{Color, Style}, - widgets::{Block, BorderType, Borders, Paragraph}, - Frame, -}; - -use crate::tui::layout::FocusedArea; - -use super::styled_title; - -pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea) { - let color = if focused == FocusedArea::Content { - Color::White - } else { - Color::DarkGray - }; - - let block = Block::default() - .title(styled_title("Content", true)) - .borders(Borders::ALL) - .border_type(BorderType::Rounded) - .border_style(Style::default().fg(color)); - - let widget = Paragraph::new("TEST CONTENT").block(block); - frame.render_widget(widget, area); -} - -pub fn title(frame: &mut Frame, area: Rect, focused: FocusedArea) { - let color = if focused == FocusedArea::Content { - Color::White - } else { - Color::DarkGray - }; - - let block = Block::default() - .title(styled_title("Title", false)) - .borders(Borders::ALL) - .border_type(BorderType::Rounded) - .border_style(Style::default().fg(color)); - - let widget = Paragraph::new("TEST CONTENT").block(block); - frame.render_widget(widget, area); -} - - - -use ratatui::{ - layout::Rect, - style::{Color, Style}, - widgets::{Block, BorderType, Borders, Paragraph}, - Frame, -}; - -use crate::tui::layout::FocusedArea; - -use super::styled_title; - -pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea) { - let color = if focused == FocusedArea::Details { - Color::White - } else { - Color::DarkGray - }; - - let block = Block::default() - .title(styled_title("Details", true)) - .borders(Borders::ALL) - .border_type(BorderType::Rounded) - .border_style(Style::default().fg(color)); - - let widget = Paragraph::new("TEST CONTENT").block(block); - frame.render_widget(widget, area); -} - - - -use ratatui::{ - layout::Rect, - style::{Color, Style}, - widgets::{Block, BorderType, Borders, Paragraph}, - Frame, -}; - -use crate::tui::layout::FocusedArea; - -use super::styled_title; - -pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea) { - let color = if focused == FocusedArea::Status { - Color::White - } else { - Color::DarkGray - }; - - let block = Block::default() - .title(styled_title("Status", true)) - .borders(Borders::ALL) - .border_type(BorderType::Rounded) - .border_style(Style::default().fg(color)); - - let widget = Paragraph::new("TEST CONTENT").block(block); - frame.render_widget(widget, area); -} - - - -#[macro_export] -macro_rules! debug { - ($msg:expr) => { - $crate::logger::get_logger().debug($msg); - }; - ($fmt:expr, $($arg:tt)*) => { - $crate::logger::get_logger().debug(&format!($fmt, $($arg)*)); - }; -} - -#[macro_export] -macro_rules! info { - ($msg:expr) => { - $crate::logger::get_logger().info($msg); - }; - ($fmt:expr, $($arg:tt)*) => { - $crate::logger::get_logger().info(&format!($fmt, $($arg)*)); - }; -} - -#[macro_export] -macro_rules! error { - ($msg:expr) => { - $crate::logger::get_logger().error($msg); - }; - ($fmt:expr, $($arg:tt)*) => { - $crate::logger::get_logger().error(&format!($fmt, $($arg)*)); - }; -} - - - -/target - - - -use serde::{Deserialize, Deserializer}; -use ratatui::style::Color; -use crate::error; - -#[derive(Debug, Deserialize)] -pub struct General { - pub debug: bool, -} - -#[derive(Debug, Deserialize)] -pub struct Colors { - #[serde(deserialize_with = "deserialize_color")] - pub background: Color, // General background color - - #[serde(deserialize_with = "deserialize_color")] - pub foreground: Color, // General text color - - #[serde(deserialize_with = "deserialize_color")] - pub border_focused: Color, // Border color for focused areas - - #[serde(deserialize_with = "deserialize_color")] - pub border_unfocused: Color, // Border color for unfocused areas - - #[serde(deserialize_with = "deserialize_color")] - pub row_highlight: Color, // Highlighted row color - - #[serde(deserialize_with = "deserialize_color")] - pub row_background: Color, // Row background color - - #[serde(deserialize_with = "deserialize_color")] - pub row_alternate_bg: Color, // Alternate row background color -} - -#[derive(Debug, Deserialize)] -pub struct Config { - pub general: General, - pub colors: Colors, -} - - -pub fn parse_color(color: &str) -> Color { - match color.to_lowercase().as_str() { - "black" => Color::Black, - "red" => Color::Red, - "green" => Color::Green, - "yellow" => Color::Yellow, - "blue" => Color::Blue, - "magenta" => Color::Magenta, - "cyan" => Color::Cyan, - "white" => Color::White, - "gray" | "grey" => Color::Gray, - "darkgray" | "darkgrey" => Color::DarkGray, - "lightred" => Color::LightRed, - "lightgreen" => Color::LightGreen, - "lightyellow" => Color::LightYellow, - "lightblue" => Color::LightBlue, - "lightmagenta" => Color::LightMagenta, - "lightcyan" => Color::LightCyan, - "reset" => Color::Reset, - hex if hex.starts_with('#') && hex.len() == 7 => { - let r = u8::from_str_radix(&hex[1..3], 16).unwrap_or_else(|_| { - error!("Invalid hex color format: {}", color); - 255 - }); - let g = u8::from_str_radix(&hex[3..5], 16).unwrap_or_else(|_| { - error!("Invalid hex color format: {}", color); - 255 - }); - let b = u8::from_str_radix(&hex[5..7], 16).unwrap_or_else(|_| { - error!("Invalid hex color format: {}", color); - 255 - }); - Color::Rgb(r, g, b) - } - _ => { - error!("Invalid color name or hex value: {}", color); - panic!("Invalid config"); - } - } -} - - - -fn deserialize_color<'de, D>(deserializer: D) -> Result -where - D: Deserializer<'de>, -{ - let color_str: String = Deserialize::deserialize(deserializer)?; - Ok(parse_color(&color_str)) -} - - - -use crossterm::event::KeyCode; -use ratatui::{ - layout::{Constraint, Rect}, - style::{Modifier, Style}, - text::Text, - widgets::{ - Block, BorderType, Borders, Cell, Row, Scrollbar, ScrollbarOrientation, ScrollbarState, - Table, TableState, - }, - Frame, -}; - -use crate::{config::SETTINGS, tui::layout::FocusedArea}; - -use super::{popups, styled_title, WidgetKey}; - -#[derive(Debug, Default)] -pub struct State { - pub profiles: Vec, - pub table_state: TableState, - pub scrollbar_state: ScrollbarState, - pub show_popup: bool, -} - -#[derive(Debug, Default)] -pub struct Data { - pub title: String, - pub id: String, - pub running: bool, -} - -impl State { - fn next(&mut self) { - let i = match self.table_state.selected() { - Some(i) => { - if i >= self.profiles.len().saturating_sub(1) { - 0 - } else { - i + 1 - } - } - _none => 0, - }; - self.table_state.select(Some(i)); - self.update_scrollbar(); - } - - fn previous(&mut self) { - let i = match self.table_state.selected() { - Some(i) => { - if i == 0 { - self.profiles.len().saturating_sub(1) - } else { - i - 1 - } - } - _none => 0, - }; - self.table_state.select(Some(i)); - self.update_scrollbar(); - } - - fn update_scrollbar(&mut self) { - let items = self.profiles.len().saturating_sub(1); - let index = self.table_state.selected().unwrap_or(0); - - if self.profiles.is_empty() { - self.table_state.select(None); - } else if self.table_state.selected().is_none() { - self.table_state.select(Some(0)); - } else if index > items { - self.table_state.select(Some(items)); - } - - self.scrollbar_state = ScrollbarState::new(items).position(index); - } - - pub fn wants_popup(&self) -> bool { - self.show_popup - } -} - -impl WidgetKey for State { - fn handle_key(&mut self, key_event: &crossterm::event::KeyEvent) { - match key_event.code { - KeyCode::Char('a') => { - self.show_popup = true; - self.update_scrollbar(); - } - KeyCode::Char('d') => { - self.profiles.clear(); - self.update_scrollbar(); - } - KeyCode::Char('j') | KeyCode::Down => self.next(), - KeyCode::Char('k') | KeyCode::Up => self.previous(), - _ => {} - } - } -} - -pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea, state: &mut State) { - let color = if focused == FocusedArea::Profiles { - SETTINGS.colors.border_focused - } else { - SETTINGS.colors.border_unfocused - }; - - let block = Block::default() - .title(styled_title("Profiles", true)) - .borders(Borders::ALL) - .border_type(BorderType::Rounded) - .border_style(Style::default().fg(color)); - - frame.render_widget(&block, area); - - let scrollbar_area = Rect { - x: area.x + area.width.saturating_sub(1), - y: area.y + 1, - width: 1, - height: area.height.saturating_sub(2), - }; - - let table_area = block.inner(area); - - let rows = state.profiles.iter().enumerate().map(|(i, data)| { - let status = if data.running { "Running" } else { "Stopped" }; - - let background_color = if i % 2 == 0 { - SETTINGS.colors.row_background - } else { - SETTINGS.colors.row_alternate_bg - }; - - Row::new(vec![ - Cell::from(Text::from(format!("\n{}\n", data.title))), - Cell::from(Text::from(format!("\n{}\n", data.id))), - Cell::from(Text::from(format!("\n{}\n", status))), - ]) - .height(4) - .style(Style::default().bg(background_color)) - }); - - let widths = [ - Constraint::Percentage(40), - Constraint::Percentage(30), - Constraint::Percentage(30), - ]; - - let table = Table::new(rows, widths) - .row_highlight_style( - Style::default() - .add_modifier(Modifier::REVERSED) - .fg(SETTINGS.colors.row_highlight), - ) - .highlight_spacing(ratatui::widgets::HighlightSpacing::Always); - - frame.render_stateful_widget(table, table_area, &mut state.table_state); - - frame.render_stateful_widget( - Scrollbar::default() - .orientation(ScrollbarOrientation::VerticalRight) - .begin_symbol(Some("▲")) - .style( - Style::default() - .fg(SETTINGS.colors.border_focused) - .add_modifier(Modifier::BOLD), - ) - .thumb_symbol("┃") - .track_symbol(Some("")) - .end_symbol(Some("▼")), - scrollbar_area, - &mut state.scrollbar_state, - ); - - if state.show_popup { - let popup_area = Rect { - x: area.width / 4, - y: area.height / 3, - width: area.width / 2, - height: area.height / 3, - }; - popups::new_instance::render(frame, popup_area, focused); - } -} - - - -use std::sync::Mutex; -use chrono::Local; -use color_eyre::owo_colors::OwoColorize; -use lazy_static::lazy_static; - -pub struct Logger { - debug: bool, -} - -impl Logger { - pub fn init(debug: bool) { - let mut logger = LOGGER.lock().unwrap(); - logger.debug = debug; - } - - fn timestamp() -> String { - Local::now().format("%Y-%m-%d %H:%M:%S").to_string() - } - - pub fn debug(&self, message: &str) { - if self.debug { - println!( - "{} {} {}", - Self::timestamp().dimmed(), - "[DEBUG]".cyan(), - message - ); - } - } - - pub fn info(&self, message: &str) { - println!( - "{} {} {}", - Self::timestamp().dimmed(), - "[INFO]".green(), - message - ); - } - - pub fn error(&self, message: &str) { - eprintln!( - "{} {} {}", - Self::timestamp().dimmed(), - "[ERROR]".red().bold(), - message - ); - } -} - -lazy_static! { - pub static ref LOGGER: Mutex = Mutex::new(Logger { debug: false }); -} - -pub fn get_logger() -> std::sync::MutexGuard<'static, Logger> { - LOGGER.lock().unwrap() -} - - - -use crossterm::event::KeyEvent; -use ratatui::{ - style::{Color, Style}, - text::{Line, Span}, -}; - -pub mod account; -pub mod content; -pub mod details; -pub mod profiles; -pub mod status; -pub mod popups; - -pub fn styled_title(title: &str, highlight: bool) -> Line { - if !highlight || title.is_empty() { - Line::from(Span::raw(title)) - } else { - let mut chars = title.chars(); - let first = chars.next().unwrap_or_default().to_string(); - let rest: String = chars.collect(); - Line::from(vec![ - Span::styled(first, Style::default().fg(Color::Yellow)), - Span::raw(rest), - ]) - } -} - -pub trait WidgetKey { - fn handle_key(&mut self, key_event: &KeyEvent); -} - - - -[general] -debug = false - -[colors] -background = "#1e1e1e" -foreground = "white" -border_focused = "white" -border_unfocused = "darkgray" -row_highlight = "yellow" -row_background = "darkgray" -row_alternate_bg = "#282828" - - - -use config::{Config as ConfigLoader, ConfigError, File}; -use dirs_next::config_dir; -use once_cell::sync::Lazy; -use std::fs; -use std::path::PathBuf; -use types::Config; - -use crate::debug; - -pub mod types; - -pub fn get_config_path() -> PathBuf { - let base_dir = config_dir().unwrap(); - base_dir.join("mcl/") -} - -fn ensure_config_exists(default_path: &str) -> PathBuf { - let config_path = get_config_path().join("config.toml"); - - if !config_path.exists() { - if let Some(parent_dir) = config_path.parent() { - fs::create_dir_all(parent_dir).expect("Failed to create configuration directory"); - } - - fs::copy(default_path, &config_path).expect("Failed to copy default configuration file"); - debug!("Default configuration copied to '{}'", config_path.display()); - } - - config_path -} - -pub fn load_config(config_path: &PathBuf) -> Result { - ConfigLoader::builder() - .add_source(File::from(config_path.clone())) - .build()? - .try_deserialize() -} - -pub static SETTINGS: Lazy = Lazy::new(|| { - let path: PathBuf = ensure_config_exists("assets/default.toml"); - load_config(&path).expect("Failed to load configuration") -}); - - - -use clap::{Arg, ArgAction, Command}; -use crate::{debug, tui}; - -pub fn init() { - let matches = Command::new("mcl") - .about("Minecraft CLI Launcher") - .version("1.0.0") - .subcommand_required(false) - .arg_required_else_help(false) - .subcommand( - Command::new("launch") - .about("Launch Minecraft with a specific profile") - .arg_required_else_help(true) - .arg( - Arg::new("profile") - .short('p') - .long("profile") - .help("Profile to launch (e.g., main)") - .required(true) - .action(ArgAction::Set), - ) - .arg( - Arg::new("offline") - .short('o') - .long("offline") - .help("Launch Minecraft in offline mode") - .action(ArgAction::SetTrue), - ) - .arg( - Arg::new("memory") - .short('m') - .long("memory") - .help("Set memory allocation for Minecraft (e.g., 4G, 512M)") - .action(ArgAction::Set), - ) - .arg( - Arg::new("resolution") - .short('r') - .long("resolution") - .help("Set screen resolution (e.g., 1920x1080)") - .action(ArgAction::Set), - ) - .arg( - Arg::new("jvm-args") - .short('j') - .long("jvm-args") - .help("Custom JVM arguments for Minecraft (e.g., -Xmx4G)") - .action(ArgAction::Set) - .num_args(1..), - ) - .arg( - Arg::new("no-window") - .short('n') - .long("no-window") - .help("Run Minecraft in headless mode (no graphical window)") - .action(ArgAction::SetTrue), - ), - ) - .subcommand( - Command::new("profiles") - .about("Manage Minecraft profiles") - .arg_required_else_help(true) - .arg( - Arg::new("list") - .short('l') - .long("list") - .help("List all available profiles") - .conflicts_with("delete") // Ensures list and delete are mutually exclusive - .action(ArgAction::SetTrue), - ) - .arg( - Arg::new("delete") - .short('d') - .long("delete") - .help("Delete a specific profile") - .action(ArgAction::Set), - ), - ) - .get_matches(); - - if matches.subcommand().is_none() { - tui::show().unwrap() - } - - match matches.subcommand() { - Some(("launch", launch_matches)) => { - let profile = launch_matches - .get_one::("profile") - .expect("Profile is required"); - - let mem_default = String::from("Default"); - let memory = launch_matches - .get_one::("memory") - .unwrap_or(&mem_default); - - let res_default = String::from("Default"); - let resolution = launch_matches - .get_one::("resolution") - .unwrap_or(&res_default); - - let jvm_args = launch_matches - .get_many::("jvm-args") - .map(|args| args.map(|s| s.as_str()).collect::>().join(" ")) - .unwrap_or_else(|| "None".to_string()); - - if launch_matches.get_flag("offline") { - debug!("Launching profile '{}' in offline mode...", profile); - } else { - debug!("Launching profile '{}' in online mode...", profile); - } - - debug!("Memory: {}", memory); - debug!("Resolution: {}", resolution); - debug!("JVM Args: {}", jvm_args); - - if launch_matches.get_flag("no-window") { - debug!("Running in headless mode..."); - } - } - Some(("profiles", profiles_matches)) => { - if profiles_matches.get_flag("list") { - debug!("Listing all profiles..."); - } else if let Some(profile) = profiles_matches.get_one::("delete") { - debug!("Deleting profile '{}'...", profile); - } - } - _ => {}, - } - -} - - - -use config::SETTINGS; -use logger::Logger; - -mod cli; -pub mod config; -pub mod logger; -pub mod macros; -pub mod tui; - -fn main() { - Logger::init(SETTINGS.general.debug); - cli::init() -} - - - -[package] -name = "mcl" -version = "0.1.0" -authors = ["72-S"] -edition = "2021" - -[dependencies] -clap = "4.5.27" -color-eyre = "0.6.3" -config = "0.15.6" -crossterm = "0.28.1" -dirs-next = "2.0.0" -ratatui = "0.29.0" -serde = { version = "1.0.217", features = ["derive"]} -serde_derive = "1.0.217" -lazy_static = "1.5.0" -colored = "3.0.0" -chrono = "0.4.39" -image = "0.25.5" -fmt = "0.1.0" -once_cell = "1.20.3" -rascii_art = "0.4.5" - - - -use super::{ - widgets::{self, profiles, WidgetKey}, - Tui, -}; -use super::widgets::popups::new_instance; -use color_eyre::eyre::Context; -use crossterm::event::{self, Event}; -use ratatui::{ - crossterm::event::{KeyCode, KeyEvent, KeyEventKind}, - layout::{Constraint, Direction, Layout}, - Frame, -}; - -#[derive(Debug, Default)] -pub struct App { - exit: bool, - focused: FocusedArea, - profiles_state: profiles::State, -} - -#[derive(Debug, Clone, Copy, PartialEq)] -pub enum FocusedArea { - Profiles, - Content, - Account, - Details, - Status, - Popup, -} - -impl Default for FocusedArea { - fn default() -> Self { - FocusedArea::Profiles - } -} - -impl App { - /// runs the main loop until the user quits - pub fn run(&mut self, terminal: &mut Tui) -> color_eyre::Result<()> { - while !self.exit { - terminal.draw(|frame| self.render_frame(frame))?; - self.handle_events().wrap_err("handle events failed")?; - } - Ok(()) - } - - fn render_frame(&mut self, frame: &mut Frame) { - // Divide the screen into horizontal chunks - let chunks = Layout::default() - .direction(Direction::Horizontal) - .constraints([ - Constraint::Percentage(20), // Instances - Constraint::Percentage(80), // Main content - ]) - .split(frame.area()); - - // Render Instances - widgets::profiles::render(frame, chunks[0], self.focused, &mut self.profiles_state); - - // Divide the main content into vertical chunks - let main_chunks = Layout::default() - .direction(Direction::Vertical) - .constraints([ - Constraint::Length(3), // Title - Constraint::Min(10), // Main Content - Constraint::Length(5), // Bottom panel - ]) - .split(chunks[1]); - - widgets::content::title(frame, main_chunks[0], self.focused); - widgets::content::render(frame, main_chunks[1], self.focused); - - let bottom_chunks = Layout::default() - .direction(Direction::Horizontal) - .constraints([ - Constraint::Percentage(30), - Constraint::Percentage(40), - Constraint::Percentage(30), - ]) - .split(main_chunks[2]); - - widgets::account::render(frame, bottom_chunks[0], self.focused); - widgets::details::render(frame, bottom_chunks[1], self.focused); - widgets::status::render(frame, bottom_chunks[2], self.focused); - } - - /// updates the application's state based on user input - fn handle_events(&mut self) -> color_eyre::Result<()> { - match event::read()? { - Event::Key(key_event) if key_event.kind == KeyEventKind::Press => { - self.handle_key_event(key_event) - .wrap_err_with(|| format!("handling key event failed:\n{key_event:#?}")) - } - _ => Ok(()), - } - } - - fn handle_key_event(&mut self, key_event: KeyEvent) -> color_eyre::Result<()> { - match self.focused { - FocusedArea::Popup => { - new_instance::handle_key(&key_event, &mut self.profiles_state); - } - _ => { - match key_event.code { - KeyCode::Char('q') => self.exit = true, - KeyCode::Char('P') => self.focused = FocusedArea::Profiles, - KeyCode::Char('C') => self.focused = FocusedArea::Content, - KeyCode::Char('A') => self.focused = FocusedArea::Account, - KeyCode::Char('D') => self.focused = FocusedArea::Details, - KeyCode::Char('S') => self.focused = FocusedArea::Status, - _ => {} - } - - match self.focused { - FocusedArea::Profiles => self.profiles_state.handle_key(&key_event), - _ => {} - } - } - } - - if self.profiles_state.wants_popup() { - self.focused = FocusedArea::Popup; - } else if self.focused == FocusedArea::Popup { - self.focused = FocusedArea::Profiles; - } - - Ok(()) - } -} - - - -pub mod layout; -pub mod widgets; - -use std::io::{stdout, Result, Stdout}; - -use crossterm::{ - execute, - terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, -}; -use ratatui::{prelude::CrosstermBackend, Terminal}; - -pub fn show() -> color_eyre::Result<()> { - color_eyre::install()?; - let mut terminal = init_ratatui()?; - let result = layout::App::default().run(&mut terminal); - if let Err(err) = restore_ratatui() { - eprintln!( - "failed to restore terminal. Run 'reset' or restart your terminal to recover: {}", - err - ); - } - result -} - -/// TUI Impl - -pub type Tui = Terminal>; - -fn init_ratatui() -> Result { - execute!(stdout(), EnterAlternateScreen)?; - enable_raw_mode()?; - set_panic_hook(); - Terminal::new(CrosstermBackend::new(stdout())) -} - -fn set_panic_hook() { - let hook = std::panic::take_hook(); - std::panic::set_hook(Box::new(move |panic_info| { - let _ = restore_ratatui(); - hook(panic_info); - })); -} - -fn restore_ratatui() -> Result<()> { - execute!(stdout(), LeaveAlternateScreen)?; - disable_raw_mode()?; - Ok(()) -} - - - diff --git a/src/cli.rs b/src/cli/mod.rs similarity index 87% rename from src/cli.rs rename to src/cli/mod.rs index b50170e..66b2b68 100644 --- a/src/cli.rs +++ b/src/cli/mod.rs @@ -1,5 +1,5 @@ +use crate::tui; use clap::{Arg, ArgAction, Command}; -use crate::{debug, tui}; pub fn init() { let matches = Command::new("mcl") @@ -65,7 +65,7 @@ pub fn init() { .short('l') .long("list") .help("List all available profiles") - .conflicts_with("delete") // Ensures list and delete are mutually exclusive + .conflicts_with("delete") .action(ArgAction::SetTrue), ) .arg( @@ -77,7 +77,7 @@ pub fn init() { ), ) .get_matches(); - + if matches.subcommand().is_none() { tui::show().unwrap() } @@ -104,27 +104,26 @@ pub fn init() { .unwrap_or_else(|| "None".to_string()); if launch_matches.get_flag("offline") { - debug!("Launching profile '{}' in offline mode...", profile); + tracing::debug!("Launching profile '{}' in offline mode...", profile); } else { - debug!("Launching profile '{}' in online mode...", profile); + tracing::debug!("Launching profile '{}' in online mode...", profile); } - debug!("Memory: {}", memory); - debug!("Resolution: {}", resolution); - debug!("JVM Args: {}", jvm_args); + tracing::debug!("Memory: {}", memory); + tracing::debug!("Resolution: {}", resolution); + tracing::debug!("JVM Args: {}", jvm_args); if launch_matches.get_flag("no-window") { - debug!("Running in headless mode..."); + tracing::debug!("Running in headless mode..."); } } Some(("profiles", profiles_matches)) => { if profiles_matches.get_flag("list") { - debug!("Listing all profiles..."); + tracing::debug!("Listing all profiles..."); } else if let Some(profile) = profiles_matches.get_one::("delete") { - debug!("Deleting profile '{}'...", profile); + tracing::debug!("Deleting profile '{}'...", profile); } } - _ => {}, + _ => {} } - } diff --git a/src/config/mod.rs b/src/config/mod.rs index 95a90e1..da874be 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -5,8 +5,6 @@ use std::fs; use std::path::PathBuf; use types::Config; -use crate::debug; - pub mod types; pub fn get_config_path() -> PathBuf { @@ -23,7 +21,10 @@ fn ensure_config_exists(default_path: &str) -> PathBuf { } fs::copy(default_path, &config_path).expect("Failed to copy default configuration file"); - debug!("Default configuration copied to '{}'", config_path.display()); + tracing::debug!( + "Default configuration copied to '{}'", + config_path.display() + ); } config_path diff --git a/src/config/types.rs b/src/config/types.rs index 6eddaf4..1a91681 100644 --- a/src/config/types.rs +++ b/src/config/types.rs @@ -1,90 +1,11 @@ -use serde::{Deserialize, Deserializer}; -use ratatui::style::Color; -use crate::error; +use serde::Deserialize; #[derive(Debug, Deserialize)] pub struct General { pub debug: bool, } -#[derive(Debug, Deserialize)] -pub struct Colors { - #[serde(deserialize_with = "deserialize_color")] - pub background: Color, // General background color - - #[serde(deserialize_with = "deserialize_color")] - pub foreground: Color, // General text color - - #[serde(deserialize_with = "deserialize_color")] - pub border_focused: Color, // Border color for focused areas - - #[serde(deserialize_with = "deserialize_color")] - pub border_unfocused: Color, // Border color for unfocused areas - - #[serde(deserialize_with = "deserialize_color")] - pub row_highlight: Color, // Highlighted row color - - #[serde(deserialize_with = "deserialize_color")] - pub row_background: Color, // Row background color - - #[serde(deserialize_with = "deserialize_color")] - pub row_alternate_bg: Color, // Alternate row background color -} - #[derive(Debug, Deserialize)] pub struct Config { pub general: General, - pub colors: Colors, -} - - -pub fn parse_color(color: &str) -> Color { - match color.to_lowercase().as_str() { - "black" => Color::Black, - "red" => Color::Red, - "green" => Color::Green, - "yellow" => Color::Yellow, - "blue" => Color::Blue, - "magenta" => Color::Magenta, - "cyan" => Color::Cyan, - "white" => Color::White, - "gray" | "grey" => Color::Gray, - "darkgray" | "darkgrey" => Color::DarkGray, - "lightred" => Color::LightRed, - "lightgreen" => Color::LightGreen, - "lightyellow" => Color::LightYellow, - "lightblue" => Color::LightBlue, - "lightmagenta" => Color::LightMagenta, - "lightcyan" => Color::LightCyan, - "reset" => Color::Reset, - hex if hex.starts_with('#') && hex.len() == 7 => { - let r = u8::from_str_radix(&hex[1..3], 16).unwrap_or_else(|_| { - error!("Invalid hex color format: {}", color); - 255 - }); - let g = u8::from_str_radix(&hex[3..5], 16).unwrap_or_else(|_| { - error!("Invalid hex color format: {}", color); - 255 - }); - let b = u8::from_str_radix(&hex[5..7], 16).unwrap_or_else(|_| { - error!("Invalid hex color format: {}", color); - 255 - }); - Color::Rgb(r, g, b) - } - _ => { - error!("Invalid color name or hex value: {}", color); - panic!("Invalid config"); - } - } -} - - - -fn deserialize_color<'de, D>(deserializer: D) -> Result -where - D: Deserializer<'de>, -{ - let color_str: String = Deserialize::deserialize(deserializer)?; - Ok(parse_color(&color_str)) } diff --git a/src/logger.rs b/src/logger.rs deleted file mode 100644 index 4891bf3..0000000 --- a/src/logger.rs +++ /dev/null @@ -1,56 +0,0 @@ -use std::sync::Mutex; -use chrono::Local; -use color_eyre::owo_colors::OwoColorize; -use lazy_static::lazy_static; - -pub struct Logger { - debug: bool, -} - -impl Logger { - pub fn init(debug: bool) { - let mut logger = LOGGER.lock().unwrap(); - logger.debug = debug; - } - - fn timestamp() -> String { - Local::now().format("%Y-%m-%d %H:%M:%S").to_string() - } - - pub fn debug(&self, message: &str) { - if self.debug { - println!( - "{} {} {}", - Self::timestamp().dimmed(), - "[DEBUG]".cyan(), - message - ); - } - } - - pub fn info(&self, message: &str) { - println!( - "{} {} {}", - Self::timestamp().dimmed(), - "[INFO]".green(), - message - ); - } - - pub fn error(&self, message: &str) { - eprintln!( - "{} {} {}", - Self::timestamp().dimmed(), - "[ERROR]".red().bold(), - message - ); - } -} - -lazy_static! { - pub static ref LOGGER: Mutex = Mutex::new(Logger { debug: false }); -} - -pub fn get_logger() -> std::sync::MutexGuard<'static, Logger> { - LOGGER.lock().unwrap() -} diff --git a/src/macros.rs b/src/macros.rs deleted file mode 100644 index 6c5829f..0000000 --- a/src/macros.rs +++ /dev/null @@ -1,29 +0,0 @@ -#[macro_export] -macro_rules! debug { - ($msg:expr) => { - $crate::logger::get_logger().debug($msg); - }; - ($fmt:expr, $($arg:tt)*) => { - $crate::logger::get_logger().debug(&format!($fmt, $($arg)*)); - }; -} - -#[macro_export] -macro_rules! info { - ($msg:expr) => { - $crate::logger::get_logger().info($msg); - }; - ($fmt:expr, $($arg:tt)*) => { - $crate::logger::get_logger().info(&format!($fmt, $($arg)*)); - }; -} - -#[macro_export] -macro_rules! error { - ($msg:expr) => { - $crate::logger::get_logger().error($msg); - }; - ($fmt:expr, $($arg:tt)*) => { - $crate::logger::get_logger().error(&format!($fmt, $($arg)*)); - }; -} diff --git a/src/main.rs b/src/main.rs index e3f6839..ca94eda 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,13 +1,9 @@ -use config::SETTINGS; -use logger::Logger; - mod cli; pub mod config; -pub mod logger; -pub mod macros; pub mod tui; fn main() { - Logger::init(SETTINGS.general.debug); + let _guard = tui::logging::init(); + color_eyre::install().expect("Failed to install color-eyre"); cli::init() } diff --git a/src/tui/layout.rs b/src/tui/layout.rs index 36557e5..afe1e38 100644 --- a/src/tui/layout.rs +++ b/src/tui/layout.rs @@ -1,8 +1,8 @@ +use super::widgets::popups::new_instance; use super::{ widgets::{self, profiles, WidgetKey}, Tui, }; -use super::widgets::popups::new_instance; use color_eyre::eyre::Context; use crossterm::event::{self, Event}; use ratatui::{ @@ -18,8 +18,9 @@ pub struct App { profiles_state: profiles::State, } -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Default, Debug, Clone, Copy, PartialEq)] pub enum FocusedArea { + #[default] Profiles, Content, Account, @@ -28,14 +29,7 @@ pub enum FocusedArea { Popup, } -impl Default for FocusedArea { - fn default() -> Self { - FocusedArea::Profiles - } -} - impl App { - /// runs the main loop until the user quits pub fn run(&mut self, terminal: &mut Tui) -> color_eyre::Result<()> { while !self.exit { terminal.draw(|frame| self.render_frame(frame))?; @@ -45,7 +39,6 @@ impl App { } fn render_frame(&mut self, frame: &mut Frame) { - // Divide the screen into horizontal chunks let chunks = Layout::default() .direction(Direction::Horizontal) .constraints([ @@ -54,10 +47,8 @@ impl App { ]) .split(frame.area()); - // Render Instances widgets::profiles::render(frame, chunks[0], self.focused, &mut self.profiles_state); - // Divide the main content into vertical chunks let main_chunks = Layout::default() .direction(Direction::Vertical) .constraints([ @@ -84,13 +75,11 @@ impl App { widgets::status::render(frame, bottom_chunks[2], self.focused); } - /// updates the application's state based on user input fn handle_events(&mut self) -> color_eyre::Result<()> { match event::read()? { - Event::Key(key_event) if key_event.kind == KeyEventKind::Press => { - self.handle_key_event(key_event) - .wrap_err_with(|| format!("handling key event failed:\n{key_event:#?}")) - } + Event::Key(key_event) if key_event.kind == KeyEventKind::Press => self + .handle_key_event(key_event) + .wrap_err_with(|| format!("handling key event failed:\n{key_event:#?}")), _ => Ok(()), } } @@ -111,9 +100,8 @@ impl App { _ => {} } - match self.focused { - FocusedArea::Profiles => self.profiles_state.handle_key(&key_event), - _ => {} + if self.focused == FocusedArea::Profiles { + self.profiles_state.handle_key(&key_event) } } } diff --git a/src/tui/logging.rs b/src/tui/logging.rs new file mode 100644 index 0000000..39c067b --- /dev/null +++ b/src/tui/logging.rs @@ -0,0 +1,107 @@ +use std::collections::VecDeque; +use std::fmt; +use std::sync::{Arc, Mutex}; + +use once_cell::sync::Lazy; +use tracing::field::{Field, Visit}; +use tracing::{Level, Subscriber}; +use tracing_appender::non_blocking::WorkerGuard; +use tracing_subscriber::layer::Context; +use tracing_subscriber::prelude::*; +use tracing_subscriber::{EnvFilter, Layer}; + +use crate::config::get_config_path; + +const MAX_STATUS_EVENTS: usize = 50; + +#[derive(Debug, Clone)] +pub struct StatusEvent { + pub level: Level, + pub message: String, +} + +pub static STATUS_EVENTS: Lazy>>> = + Lazy::new(|| Arc::new(Mutex::new(VecDeque::new()))); + +pub fn init() -> WorkerGuard { + let log_dir = get_config_path(); + std::fs::create_dir_all(&log_dir).expect("Failed to create log directory"); + + let file_appender = tracing_appender::rolling::daily(&log_dir, "mcl.log"); + let (non_blocking, guard) = tracing_appender::non_blocking(file_appender); + + let env_filter = EnvFilter::builder() + .with_default_directive(Level::INFO.into()) + .from_env_lossy(); + + tracing_subscriber::registry() + .with( + tracing_subscriber::fmt::layer() + .with_writer(non_blocking) + .with_ansi(false) + .with_filter(env_filter), + ) + .with(StatusLayer::new(STATUS_EVENTS.clone())) + .init(); + + guard +} + +struct StatusLayer { + events: Arc>>, +} + +impl StatusLayer { + fn new(events: Arc>>) -> Self { + Self { events } + } +} + +impl Layer for StatusLayer { + fn on_event(&self, event: &tracing::Event<'_>, _ctx: Context<'_, S>) { + let level = *event.metadata().level(); + + // Only capture errors and warnings for the status bar + if level > Level::WARN { + return; + } + + let mut visitor = MessageVisitor::default(); + event.record(&mut visitor); + + if let Ok(mut events) = self.events.lock() { + events.push_back(StatusEvent { + level, + message: visitor.message, + }); + while events.len() > MAX_STATUS_EVENTS { + events.pop_front(); + } + } + } +} + +#[derive(Default)] +struct MessageVisitor { + message: String, +} + +impl Visit for MessageVisitor { + fn record_str(&mut self, field: &Field, value: &str) { + if field.name() == "message" { + self.message = value.to_string(); + } + } + + fn record_debug(&mut self, field: &Field, value: &dyn fmt::Debug) { + if field.name() == "message" { + let formatted = format!("{:?}", value); + // fmt::Arguments Debug wraps in quotes — strip them + self.message = formatted + .strip_prefix('"') + .and_then(|s| s.strip_suffix('"')) + .unwrap_or(&formatted) + .to_string(); + } + } +} diff --git a/src/tui/mod.rs b/src/tui/mod.rs index 0ed58ec..3e09635 100644 --- a/src/tui/mod.rs +++ b/src/tui/mod.rs @@ -1,4 +1,6 @@ pub mod layout; +pub mod logging; +pub mod theme; pub mod widgets; use std::io::{stdout, Result, Stdout}; @@ -10,7 +12,6 @@ use crossterm::{ use ratatui::{prelude::CrosstermBackend, Terminal}; pub fn show() -> color_eyre::Result<()> { - color_eyre::install()?; let mut terminal = init_ratatui()?; let result = layout::App::default().run(&mut terminal); if let Err(err) = restore_ratatui() { @@ -22,8 +23,6 @@ pub fn show() -> color_eyre::Result<()> { result } -/// TUI Impl - pub type Tui = Terminal>; fn init_ratatui() -> Result { diff --git a/src/tui/theme.rs b/src/tui/theme.rs new file mode 100644 index 0000000..7bd6540 --- /dev/null +++ b/src/tui/theme.rs @@ -0,0 +1,94 @@ +use config::{Config as ConfigLoader, File}; +use once_cell::sync::Lazy; +use ratatui::style::Color; +use serde::{Deserialize, Deserializer}; + +use crate::config::get_config_path; + +#[derive(Debug, Deserialize)] +pub struct ThemeConfig { + pub colors: Colors, +} + +#[derive(Debug, Deserialize)] +pub struct Colors { + #[serde(deserialize_with = "deserialize_color")] + pub background: Color, + + #[serde(deserialize_with = "deserialize_color")] + pub foreground: Color, + + #[serde(deserialize_with = "deserialize_color")] + pub border_focused: Color, + + #[serde(deserialize_with = "deserialize_color")] + pub border_unfocused: Color, + + #[serde(deserialize_with = "deserialize_color")] + pub row_highlight: Color, + + #[serde(deserialize_with = "deserialize_color")] + pub row_background: Color, + + #[serde(deserialize_with = "deserialize_color")] + pub row_alternate_bg: Color, +} + +pub fn parse_color(color: &str) -> Color { + match color.to_lowercase().as_str() { + "black" => Color::Black, + "red" => Color::Red, + "green" => Color::Green, + "yellow" => Color::Yellow, + "blue" => Color::Blue, + "magenta" => Color::Magenta, + "cyan" => Color::Cyan, + "white" => Color::White, + "gray" | "grey" => Color::Gray, + "darkgray" | "darkgrey" => Color::DarkGray, + "lightred" => Color::LightRed, + "lightgreen" => Color::LightGreen, + "lightyellow" => Color::LightYellow, + "lightblue" => Color::LightBlue, + "lightmagenta" => Color::LightMagenta, + "lightcyan" => Color::LightCyan, + "reset" => Color::Reset, + hex if hex.starts_with('#') && hex.len() == 7 => { + let r = u8::from_str_radix(&hex[1..3], 16).unwrap_or_else(|_| { + eprintln!("Invalid hex color format: {}", color); + 255 + }); + let g = u8::from_str_radix(&hex[3..5], 16).unwrap_or_else(|_| { + eprintln!("Invalid hex color format: {}", color); + 255 + }); + let b = u8::from_str_radix(&hex[5..7], 16).unwrap_or_else(|_| { + eprintln!("Invalid hex color format: {}", color); + 255 + }); + Color::Rgb(r, g, b) + } + _ => { + eprintln!("Invalid color name or hex value: {}", color); + panic!("Invalid config"); + } + } +} + +fn deserialize_color<'de, D>(deserializer: D) -> Result +where + D: Deserializer<'de>, +{ + let color_str: String = Deserialize::deserialize(deserializer)?; + Ok(parse_color(&color_str)) +} + +pub static THEME: Lazy = Lazy::new(|| { + let config_path = get_config_path().join("config.toml"); + ConfigLoader::builder() + .add_source(File::from(config_path)) + .build() + .expect("Failed to load theme config") + .try_deserialize() + .expect("Failed to parse theme config") +}); diff --git a/src/tui/widgets/mod.rs b/src/tui/widgets/mod.rs index 4f645e2..7b155d3 100644 --- a/src/tui/widgets/mod.rs +++ b/src/tui/widgets/mod.rs @@ -7,11 +7,11 @@ use ratatui::{ pub mod account; pub mod content; pub mod details; +pub mod popups; pub mod profiles; pub mod status; -pub mod popups; -pub fn styled_title(title: &str, highlight: bool) -> Line { +pub fn styled_title(title: &str, highlight: bool) -> Line<'_> { if !highlight || title.is_empty() { Line::from(Span::raw(title)) } else { @@ -26,5 +26,5 @@ pub fn styled_title(title: &str, highlight: bool) -> Line { } pub trait WidgetKey { - fn handle_key(&mut self, key_event: &KeyEvent); + fn handle_key(&mut self, key_event: &KeyEvent); } diff --git a/src/tui/widgets/popups/new_instance.rs b/src/tui/widgets/popups/new_instance.rs index 7872599..ca1b974 100644 --- a/src/tui/widgets/popups/new_instance.rs +++ b/src/tui/widgets/popups/new_instance.rs @@ -2,17 +2,18 @@ use super::base::Popup; use crate::tui::layout::FocusedArea; use crate::tui::widgets::profiles; use crossterm::event::KeyCode; -use ratatui::{ - Frame, - style::{Color, Style}, - layout::{Rect, Layout, Direction, Constraint}, - text::{Line, Span}, - widgets::{Block, Borders, Paragraph, Wrap, Widget}, -}; use once_cell::sync::Lazy; +use ratatui::{ + layout::{Constraint, Direction, Layout, Rect}, + style::{Color, Style}, + text::{Line, Span}, + widgets::{Block, Borders, Paragraph, Widget, Wrap}, + Frame, +}; use std::sync::Mutex; -static INSTANCE_POPUP_STATE: Lazy> = Lazy::new(|| Mutex::new(NewInstanceState::default())); +static INSTANCE_POPUP_STATE: Lazy> = + Lazy::new(|| Mutex::new(NewInstanceState::default())); #[derive(Debug, Default)] enum NewInstanceMode { @@ -32,39 +33,43 @@ pub fn render(frame: &mut Frame, area: Rect, _focused: FocusedArea) { let popup = Popup { title: Line::from("New Instance"), - content: Box::new(move |area, buf| { - match state.mode { - NewInstanceMode::Buttons => { - let chunks = Layout::default() - .direction(Direction::Vertical) - .constraints([ - Constraint::Percentage(40), - Constraint::Length(3), - Constraint::Length(3), - Constraint::Percentage(40), - ]) - .split(area); + content: Box::new(move |area, buf| match state.mode { + NewInstanceMode::Buttons => { + let chunks = Layout::default() + .direction(Direction::Vertical) + .constraints([ + Constraint::Percentage(40), + Constraint::Length(3), + Constraint::Length(3), + Constraint::Percentage(40), + ]) + .split(area); - let create_button = Paragraph::new(Line::from(vec![ - Span::styled("C", Style::default().fg(Color::Yellow)), - Span::raw("reate New Instance"), - ])).alignment(ratatui::layout::Alignment::Center); + let create_button = Paragraph::new(Line::from(vec![ + Span::styled("C", Style::default().fg(Color::Yellow)), + Span::raw("reate New Instance"), + ])) + .alignment(ratatui::layout::Alignment::Center); - let import_button = Paragraph::new(Line::from(vec![ - Span::styled("I", Style::default().fg(Color::Yellow)), - Span::raw("mport Morinth Modpack"), - ])).alignment(ratatui::layout::Alignment::Center); + let import_button = Paragraph::new(Line::from(vec![ + Span::styled("I", Style::default().fg(Color::Yellow)), + Span::raw("mport Morinth Modpack"), + ])) + .alignment(ratatui::layout::Alignment::Center); - create_button.render(chunks[1], buf); - import_button.render(chunks[2], buf); - } - NewInstanceMode::Input => { - let paragraph = Paragraph::new(state.input_text.clone()) - .block(Block::default().title("Enter URL or Path").borders(Borders::ALL)) - .wrap(Wrap { trim: true }); + create_button.render(chunks[1], buf); + import_button.render(chunks[2], buf); + } + NewInstanceMode::Input => { + let paragraph = Paragraph::new(state.input_text.clone()) + .block( + Block::default() + .title("Enter URL or Path") + .borders(Borders::ALL), + ) + .wrap(Wrap { trim: true }); - paragraph.render(area, buf); - } + paragraph.render(area, buf); } }), border_style: Default::default(), diff --git a/src/tui/widgets/profiles.rs b/src/tui/widgets/profiles.rs index fc82355..4652466 100644 --- a/src/tui/widgets/profiles.rs +++ b/src/tui/widgets/profiles.rs @@ -10,7 +10,7 @@ use ratatui::{ Frame, }; -use crate::{config::SETTINGS, tui::layout::FocusedArea}; +use crate::tui::{layout::FocusedArea, theme::THEME}; use super::{popups, styled_title, WidgetKey}; @@ -100,9 +100,9 @@ impl WidgetKey for State { pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea, state: &mut State) { let color = if focused == FocusedArea::Profiles { - SETTINGS.colors.border_focused + THEME.colors.border_focused } else { - SETTINGS.colors.border_unfocused + THEME.colors.border_unfocused }; let block = Block::default() @@ -126,9 +126,9 @@ pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea, state: &mut S let status = if data.running { "Running" } else { "Stopped" }; let background_color = if i % 2 == 0 { - SETTINGS.colors.row_background + THEME.colors.row_background } else { - SETTINGS.colors.row_alternate_bg + THEME.colors.row_alternate_bg }; Row::new(vec![ @@ -150,7 +150,7 @@ pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea, state: &mut S .row_highlight_style( Style::default() .add_modifier(Modifier::REVERSED) - .fg(SETTINGS.colors.row_highlight), + .fg(THEME.colors.row_highlight), ) .highlight_spacing(ratatui::widgets::HighlightSpacing::Always); @@ -162,7 +162,7 @@ pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea, state: &mut S .begin_symbol(Some("▲")) .style( Style::default() - .fg(SETTINGS.colors.border_focused) + .fg(THEME.colors.border_focused) .add_modifier(Modifier::BOLD), ) .thumb_symbol("┃") diff --git a/src/tui/widgets/status.rs b/src/tui/widgets/status.rs index 83001ae..2f58440 100644 --- a/src/tui/widgets/status.rs +++ b/src/tui/widgets/status.rs @@ -1,16 +1,19 @@ use ratatui::{ layout::Rect, style::{Color, Style}, + text::{Line, Span}, widgets::{Block, BorderType, Borders, Paragraph}, Frame, }; +use tracing::Level; use crate::tui::layout::FocusedArea; +use crate::tui::logging::STATUS_EVENTS; use super::styled_title; pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea) { - let color = if focused == FocusedArea::Status { + let border_color = if focused == FocusedArea::Status { Color::White } else { Color::DarkGray @@ -20,8 +23,29 @@ pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea) { .title(styled_title("Status", true)) .borders(Borders::ALL) .border_type(BorderType::Rounded) - .border_style(Style::default().fg(color)); + .border_style(Style::default().fg(border_color)); - let widget = Paragraph::new("TEST CONTENT").block(block); - frame.render_widget(widget, area); + let latest = STATUS_EVENTS + .lock() + .ok() + .and_then(|events| events.back().cloned()); + + let content = match latest { + Some(event) => { + let (label, label_color) = match event.level { + Level::ERROR => (" ERROR ", Color::Red), + Level::WARN => (" WARN ", Color::Yellow), + _ => (" INFO ", Color::White), + }; + + Paragraph::new(Line::from(vec![ + Span::styled(label, Style::default().fg(Color::White).bg(label_color)), + Span::raw(" "), + Span::raw(event.message), + ])) + } + None => Paragraph::new(Span::styled("Ready", Style::default().fg(Color::DarkGray))), + }; + + frame.render_widget(content.block(block), area); }