diff --git a/Cargo.lock b/Cargo.lock index 2b554b2..5bb912e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -72,15 +72,15 @@ dependencies = [ [[package]] name = "ansi-to-tui" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00c4af0bef1b514c9b6a32a773caf604c1390fa7913f4eaa23bfe76f251d6a42" +checksum = "67555e1f1ece39d737e28c8a017721287753af3f93225e4a445b29ccb0f5912c" dependencies = [ "nom", "ratatui", "simdutf8", "smallvec", - "thiserror", + "thiserror 1.0.61", ] [[package]] @@ -184,9 +184,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" dependencies = [ "serde", ] @@ -205,9 +205,9 @@ dependencies = [ [[package]] name = "bollard" -version = "0.17.1" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d41711ad46fda47cd701f6908e59d1bd6b9a2b7464c0d0aeab95c6d37096ff8a" +checksum = "97ccca1260af6a459d75994ad5acc1651bcabcbdbc41467cc9786519ab854c30" dependencies = [ "base64", "bollard-stubs", @@ -234,7 +234,7 @@ dependencies = [ "serde_json", "serde_repr", "serde_urlencoded", - "thiserror", + "thiserror 2.0.3", "tokio", "tokio-util", "tower-service", @@ -244,9 +244,9 @@ dependencies = [ [[package]] name = "bollard-stubs" -version = "1.45.0-rc.26.0.1" +version = "1.47.1-rc.27.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7c5415e3a6bc6d3e99eff6268e488fd4ee25e7b28c10f08fa6760bd9de16e4" +checksum = "3f179cfbddb6e77a5472703d4b30436bff32929c0aa8a9008ecf23d1d3cdd0da" dependencies = [ "serde", "serde_repr", @@ -285,9 +285,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byte-unit" -version = "5.1.4" +version = "5.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ac19bdf0b2665407c39d82dbc937e951e7e2001609f0fb32edd0af45a2d63e" +checksum = "e1cd29c3c585209b0cbc7309bfe3ed7efd8c84c21b7af29c8bfae908f8777174" dependencies = [ "rust_decimal", "serde", @@ -372,9 +372,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.20" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" dependencies = [ "clap_builder", "clap_derive", @@ -382,9 +382,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.20" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" dependencies = [ "anstream", "anstyle", @@ -460,9 +460,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.4" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" dependencies = [ "core-foundation-sys", "libc", @@ -470,9 +470,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "crc32fast" @@ -511,9 +511,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ "darling_core", "darling_macro", @@ -521,9 +521,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", @@ -535,9 +535,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", @@ -556,18 +556,18 @@ dependencies = [ [[package]] name = "derive_builder" -version = "0.20.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0350b5cb0331628a5916d6c5c0b72e97393b8b6b03b47a9284f4e7f5a405ffd7" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" dependencies = [ "derive_builder_macro", ] [[package]] name = "derive_builder_core" -version = "0.20.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d48cda787f839151732d396ac69e3473923d54312c070ee21e9effcaa8ca0b1d" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" dependencies = [ "darling", "proc-macro2", @@ -577,9 +577,9 @@ dependencies = [ [[package]] name = "derive_builder_macro" -version = "0.20.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", "syn 2.0.87", @@ -1193,6 +1193,12 @@ dependencies = [ "serde", ] +[[package]] +name = "indoc" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" + [[package]] name = "instability" version = "0.3.2" @@ -1609,31 +1615,31 @@ dependencies = [ [[package]] name = "ratatui" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdef7f9be5c0122f890d58bdf4d964349ba6a6161f705907526d891efabba57d" +checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b" dependencies = [ "bitflags", "cassowary", "compact_str", "crossterm", + "indoc", "instability", "itertools 0.13.0", "lru", "paste", "serde", "strum", - "strum_macros", "unicode-segmentation", "unicode-truncate", - "unicode-width", + "unicode-width 0.2.0", ] [[package]] name = "ratatui-macros" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "142d72442aff1ba834b80f50a22a48302e665e90b3a43eaab52bf99b037df0c0" +checksum = "6fef540f80dbe8a0773266fa6077788ceb65ef624cdbf36e131aaf90b4a52df4" dependencies = [ "ratatui", ] @@ -1655,7 +1661,7 @@ checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" dependencies = [ "getrandom", "libredox", - "thiserror", + "thiserror 1.0.61", ] [[package]] @@ -1792,9 +1798,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.10" +version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ "log", "once_cell", @@ -1807,12 +1813,11 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" dependencies = [ "openssl-probe", - "rustls-pemfile", "rustls-pki-types", "schannel", "security-framework", @@ -1830,15 +1835,15 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" [[package]] name = "rustls-webpki" -version = "0.102.4" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -1880,9 +1885,9 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "security-framework" -version = "2.11.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +checksum = "e1415a607e92bec364ea2cf9264646dcce0f91e6d65281bd6f2819cca3bf39c8" dependencies = [ "bitflags", "core-foundation", @@ -1893,9 +1898,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" dependencies = [ "core-foundation-sys", "libc", @@ -2083,9 +2088,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.26.2" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ "strum_macros", ] @@ -2166,7 +2171,16 @@ version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.61", +] + +[[package]] +name = "thiserror" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +dependencies = [ + "thiserror-impl 2.0.3", ] [[package]] @@ -2180,6 +2194,17 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "thiserror-impl" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "thread_local" version = "1.1.8" @@ -2344,9 +2369,9 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -2355,9 +2380,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -2366,9 +2391,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -2376,9 +2401,9 @@ dependencies = [ [[package]] name = "tracing-error" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" +checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db" dependencies = [ "tracing", "tracing-subscriber", @@ -2397,9 +2422,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -2421,9 +2446,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tui-big-text" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399b145b30537641e56878b64bf648e04e1df996efb5d32cd7f19944152e3868" +checksum = "8b046cf880cb40db75567b60ca22dc38a4165ef490be6bfad5718b22bcb6aabf" dependencies = [ "derive_builder", "font8x8", @@ -2450,7 +2475,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5fbabedabe362c618c714dbefda9927b5afc8e2a8102f47f081089a9019226" dependencies = [ "itertools 0.12.1", - "unicode-width", + "unicode-width 0.1.13", ] [[package]] @@ -2459,6 +2484,12 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + [[package]] name = "untrusted" version = "0.9.0" @@ -2467,12 +2498,13 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.10.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" +checksum = "b30e6f97efe1fa43535ee241ee76967d3ff6ff3953ebb430d8d55c5393029e7b" dependencies = [ "base64", "flate2", + "litemap", "log", "once_cell", "rustls", @@ -2481,6 +2513,8 @@ dependencies = [ "serde_json", "url", "webpki-roots", + "yoke", + "zerofrom", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 7443f77..ecef24f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,12 +13,12 @@ categories = ["command-line-utilities", "development-tools"] include = ["/src", "LICENSE.txt", "CHANGELOG.md", "README.md"] [dependencies] -ansi-to-tui = "6.0.0" +ansi-to-tui = "7.0.0" async-trait = "0.1.83" -bollard = { version = "0.17.1", features = ["ssl"] } -byte-unit = { version = "5.1.4", features = ["byte"] } +bollard = { version = "0.18.1", features = ["ssl"] } +byte-unit = { version = "5.1.6", features = ["byte"] } chrono = "0.4.38" -clap = { version = "4.5.20", features = ["derive"] } +clap = { version = "4.5.21", features = ["derive"] } color-eyre = "0.6.3" crossterm = { version = "0.28", features = ["event-stream"] } dirs-next = "2.0.0" @@ -26,11 +26,11 @@ dyn-clone = "1.0.17" futures = "0.3.31" itertools = "0.13.0" lazy_static = "1.5.0" -ratatui = { version = "0.28.1", features = [ +ratatui = { version = "0.29.0", features = [ "serde", "unstable-rendered-line-info", ] } -ratatui-macros = "0.5.0" +ratatui-macros = "0.6.0" serde = "1.0.215" serde_yml = "0.0.12" tokio = { version = "1.41.1", features = [ @@ -38,11 +38,11 @@ tokio = { version = "1.41.1", features = [ "macros", "process", ] } -tracing = "0.1.40" -tracing-error = "0.2.0" -tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } -tui-big-text = "0.6.0" -ureq = { version = "2.10.1", features = ["json"] } +tracing = "0.1.41" +tracing-error = "0.2.1" +tracing-subscriber = { version = "0.3.19", features = ["env-filter"] } +tui-big-text = "0.7.0" +ureq = { version = "2.11.0", features = ["json"] } [profile.release] diff --git a/src/components/alert_modal.rs b/src/components/alert_modal.rs index 8e8ca4d..ece5480 100644 --- a/src/components/alert_modal.rs +++ b/src/components/alert_modal.rs @@ -3,9 +3,9 @@ use core::fmt; use color_eyre::eyre::Result; use ratatui::{ - layout::{Alignment, Rect}, - text::{Span, Text}, - widgets::{block::Title, Paragraph, Wrap}, + layout::Rect, + text::{Line, Span, Text}, + widgets::{Paragraph, Wrap}, Frame, }; @@ -73,7 +73,7 @@ where _ => return, }; - let title = Title::from(format!("< {} >", self.title.clone())).alignment(Alignment::Center); + let title = Line::from(format!("< {} >", self.title.clone())).centered(); let message = Paragraph::new(Text::from(message)) .wrap(Wrap { trim: true }) diff --git a/src/components/boolean_modal.rs b/src/components/boolean_modal.rs index cc5b729..7ce07a7 100644 --- a/src/components/boolean_modal.rs +++ b/src/components/boolean_modal.rs @@ -5,10 +5,10 @@ use itertools::Itertools; use color_eyre::eyre::Result; use ratatui::{ - layout::{Alignment, Rect}, + layout::Rect, style::{Modifier, Style}, - text::{Span, Text}, - widgets::{block::Title, Paragraph, Wrap}, + text::{Line, Span, Text}, + widgets::{Paragraph, Wrap}, Frame, }; @@ -89,7 +89,7 @@ where _ => return, }; - let title = Title::from(format!("< {} >", self.title.clone())).alignment(Alignment::Center); + let title = Line::from(format!("< {} >", self.title.clone())).centered(); let message = Paragraph::new(Text::from(message)) .wrap(Wrap { trim: true }) diff --git a/src/components/resize_notice.rs b/src/components/resize_notice.rs index c811df0..724a811 100644 --- a/src/components/resize_notice.rs +++ b/src/components/resize_notice.rs @@ -1,10 +1,9 @@ use std::sync::Arc; use ratatui::{ - layout::{self}, style::Style, text::{Line, Span, Text}, - widgets::{block::Title, Block}, + widgets::Block, }; use ratatui_macros::{horizontal, vertical}; @@ -79,7 +78,7 @@ impl Component for ResizeScreen { let info = Text::from(messages).alignment(ratatui::layout::Alignment::Center); let block = Block::bordered() - .title(Title::from("< Terminal Too Small >").alignment(layout::Alignment::Center)) + .title(Line::from("< Terminal Too Small >").centered()) .border_style(Style::default().fg(self.config.theme.negative_highlight())); let [_, inner_area, _] = vertical![>=0, <=5, >=0].areas(area); diff --git a/src/main.rs b/src/main.rs index 3aaf409..48ab5c6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,10 +47,10 @@ async fn main() -> color_eyre::Result<()> { let docker = new_local_docker_connection(&config.docker_path) .await .context(format!("failed to create docker connection, potentially due to misconfiguration (see {CONFIGURATION_DOC_PATH})"))?; - terminal::init_panic_hook(); - let mut terminal = terminal::init().context("failed to initialise terminal")?; + let mut terminal = ratatui::init(); + terminal.clear()?; let mut events = EventLoop::new(); let events_tx = events.get_tx(); @@ -83,7 +83,8 @@ async fn main() -> color_eyre::Result<()> { } Message::Transition(t) => { if t == events::Transition::ToNewTerminal { - terminal = terminal::init().context("failed to initialise terminal")?; + terminal = ratatui::init(); + terminal.clear()?; } else { let _ = &app.transition(t).await; } @@ -99,7 +100,7 @@ async fn main() -> color_eyre::Result<()> { } } - terminal::restore().context("failed to restore terminal")?; + ratatui::restore(); Ok(()) } diff --git a/src/pages/containers.rs b/src/pages/containers.rs index 55e7275..a8ce5bf 100644 --- a/src/pages/containers.rs +++ b/src/pages/containers.rs @@ -352,7 +352,7 @@ impl Component for Containers { let table = Table::new(rows.clone(), widths) .header(columns.clone().style(Style::new().bold())) - .highlight_style(Style::new().reversed()); + .row_highlight_style(Style::new().reversed()); f.render_stateful_widget(table, area, &mut self.list_state); diff --git a/src/pages/images.rs b/src/pages/images.rs index 38e984b..0ac79b4 100644 --- a/src/pages/images.rs +++ b/src/pages/images.rs @@ -309,7 +309,7 @@ impl Component for Images { let table = Table::new(rows.clone(), widths) .header(columns.clone().style(Style::new().bold())) - .highlight_style(Style::new().reversed()); + .row_highlight_style(Style::new().reversed()); f.render_stateful_widget(table, area, &mut self.list_state); diff --git a/src/pages/networks.rs b/src/pages/networks.rs index bb0640f..3634d06 100644 --- a/src/pages/networks.rs +++ b/src/pages/networks.rs @@ -298,7 +298,7 @@ impl Component for Network { let table = Table::new(rows.clone(), widths) .header(columns.clone().style(Style::new().bold())) - .highlight_style(Style::new().reversed()); + .row_highlight_style(Style::new().reversed()); f.render_stateful_widget(table, area, &mut self.list_state); diff --git a/src/pages/volumes.rs b/src/pages/volumes.rs index bd00f35..496671d 100644 --- a/src/pages/volumes.rs +++ b/src/pages/volumes.rs @@ -306,7 +306,7 @@ impl Component for Volume { let table = Table::new(rows.clone(), widths) .header(columns.clone().style(Style::new().bold())) - .highlight_style(Style::new().reversed()); + .row_highlight_style(Style::new().reversed()); f.render_stateful_widget(table, area, &mut self.list_state); diff --git a/src/terminal.rs b/src/terminal.rs index cb35cda..8a8b888 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -1,31 +1,10 @@ -use crossterm::{ - terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, - ExecutableCommand, -}; -use ratatui::prelude::*; -use std::{ - io::stdout, - panic::{set_hook, take_hook}, -}; - -pub fn init() -> std::io::Result> { - enable_raw_mode()?; - stdout().execute(EnterAlternateScreen)?; - let terminal = Terminal::new(CrosstermBackend::new(stdout()))?; - Ok(terminal) -} - -pub fn restore() -> std::io::Result<()> { - stdout().execute(LeaveAlternateScreen)?; - disable_raw_mode()?; - Ok(()) -} +use std::panic::{set_hook, take_hook}; pub fn init_panic_hook() { let original_hook = take_hook(); set_hook(Box::new(move |panic_info| { // intentionally ignore errors here since we're already in a panic - let _ = restore(); + let _ = ratatui::restore(); original_hook(panic_info); })); } diff --git a/src/ui/page_manager.rs b/src/ui/page_manager.rs index 92dccb1..a9fbaff 100644 --- a/src/ui/page_manager.rs +++ b/src/ui/page_manager.rs @@ -3,8 +3,9 @@ use std::sync::Arc; use bollard::Docker; use color_eyre::eyre::{Context, Result}; use ratatui::{ - layout::{Alignment, Margin, Rect}, - widgets::{block::Title, Block, Padding}, + layout::{Margin, Rect}, + text::Line, + widgets::{Block, Padding}, Frame, }; use tokio::sync::mpsc::Sender; @@ -182,11 +183,11 @@ impl Component for PageManager { fn draw(&mut self, f: &mut Frame<'_>, area: Rect) { let title_message = self.page.get_help().lock().unwrap().get_name(); - let title = Title::from(format!("< {} >", title_message)).alignment(Alignment::Center); + let title = Line::from(format!("< {} >", title_message)).centered(); let block = Block::bordered() .border_type(ratatui::widgets::BorderType::Plain) - .title(title) + .title_top(title) .padding(Padding::left(300)); f.render_widget(block, area); diff --git a/src/widgets/modal.rs b/src/widgets/modal.rs index 876d7da..6fb2991 100644 --- a/src/widgets/modal.rs +++ b/src/widgets/modal.rs @@ -1,7 +1,7 @@ use ratatui::{ style::Style, text::{Line, Span, Text}, - widgets::{block::Title, Block, Clear, Paragraph, Widget, Wrap}, + widgets::{Block, Clear, Paragraph, Widget, Wrap}, }; use ratatui_macros::{horizontal, vertical}; @@ -9,7 +9,7 @@ const UPPER_PAD_SIZE: u16 = 1; const MID_PAD_SIZE: u16 = 1; pub struct ModalWidget<'a> { - title: Title<'a>, + title: Line<'a>, prompt: Paragraph<'a>, opts: Vec>, width: u16, @@ -17,7 +17,7 @@ pub struct ModalWidget<'a> { } impl<'a> ModalWidget<'a> { - pub fn new(title: Title<'a>, prompt: Paragraph<'a>, opts: Vec>) -> Self { + pub fn new(title: Line<'a>, prompt: Paragraph<'a>, opts: Vec>) -> Self { Self { title, prompt, @@ -30,7 +30,7 @@ impl<'a> ModalWidget<'a> { impl<'a> Default for ModalWidget<'a> { fn default() -> Self { Self { - title: Title::from(""), + title: Line::from(""), prompt: Paragraph::new(Text::from("")), opts: vec![], width: 60, @@ -52,7 +52,7 @@ impl<'a> Widget for ModalWidget<'a> { let [_, area, _] = vertical![>=0, ==height, >=0 ].areas(area); let block = Block::bordered() - .title(self.title) + .title(self.title.centered()) .border_style(Style::default()) .style(Style::default());