diff --git a/Cargo.lock b/Cargo.lock index 5b8a153..d082dc0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -342,6 +342,21 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" +[[package]] +name = "cassowary" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" + +[[package]] +name = "castaway" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0abae9be0aaf9ea96a3b1b8b1b55c602ca751eba1b1500220cea4ecbafe7c0d5" +dependencies = [ + "rustversion", +] + [[package]] name = "cc" version = "1.0.95" @@ -457,6 +472,20 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "compact_str" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "rustversion", + "ryu", + "static_assertions", +] + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -553,6 +582,31 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +[[package]] +name = "crossterm" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" +dependencies = [ + "bitflags 2.5.0", + "crossterm_winapi", + "mio 1.0.1", + "parking_lot", + "rustix", + "signal-hook", + "signal-hook-mio", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -960,6 +1014,7 @@ dependencies = [ "notify", "pretty_assertions", "rand", + "ratatui", "secrecy", "sendmail", "serde_json", @@ -1047,8 +1102,8 @@ checksum = "b037f7449dd4a8b711e660301ff1ff28aa00eea09698421fb2d78db51a7b7a72" dependencies = [ "color-eyre", "regex", - "strum", - "strum_macros", + "strum 0.24.1", + "strum_macros 0.24.3", "tracing", "url", ] @@ -2308,6 +2363,16 @@ dependencies = [ "libc", ] +[[package]] +name = "instability" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b23a0c8dfe501baac4adf6ebbfa6eddf8f0c07f56b058cc1288017e32397846c" +dependencies = [ + "quote", + "syn 2.0.60", +] + [[package]] name = "io-close" version = "0.3.7" @@ -2335,6 +2400,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -2477,6 +2551,15 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +[[package]] +name = "lru" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" +dependencies = [ + "hashbrown 0.14.5", +] + [[package]] name = "mac-notification-sys" version = "0.3.0" @@ -2576,6 +2659,19 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mio" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" +dependencies = [ + "hermit-abi", + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.52.0", +] + [[package]] name = "mockall" version = "0.13.0" @@ -2673,7 +2769,7 @@ dependencies = [ "kqueue", "libc", "log", - "mio", + "mio 0.8.11", "walkdir", "windows-sys 0.48.0", ] @@ -2855,6 +2951,12 @@ dependencies = [ "windows-targets 0.52.5", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "path-clean" version = "1.0.1" @@ -3038,6 +3140,27 @@ dependencies = [ "getrandom 0.2.14", ] +[[package]] +name = "ratatui" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ba6a365afbe5615999275bea2446b970b10a41102500e27ce7678d50d978303" +dependencies = [ + "bitflags 2.5.0", + "cassowary", + "compact_str", + "crossterm", + "instability", + "itertools", + "lru", + "paste", + "strum 0.26.3", + "strum_macros 0.26.4", + "unicode-segmentation", + "unicode-truncate", + "unicode-width", +] + [[package]] name = "rayon" version = "1.10.0" @@ -3484,6 +3607,17 @@ dependencies = [ "signal-hook-registry", ] +[[package]] +name = "signal-hook-mio" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" +dependencies = [ + "libc", + "mio 1.0.1", + "signal-hook", +] + [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -3568,6 +3702,15 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros 0.26.4", +] + [[package]] name = "strum_macros" version = "0.24.3" @@ -3581,6 +3724,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.60", +] + [[package]] name = "subtle" version = "2.5.0" @@ -3769,7 +3925,7 @@ dependencies = [ "backtrace", "bytes", "libc", - "mio", + "mio 0.8.11", "num_cpus", "parking_lot", "pin-project-lite", @@ -4058,6 +4214,29 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + +[[package]] +name = "unicode-truncate" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" +dependencies = [ + "itertools", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "unicode-width" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" + [[package]] name = "unicode-xid" version = "0.2.4" diff --git a/Cargo.toml b/Cargo.toml index 5b7cf9d..b7a63f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,9 @@ git-next-core = { path = "crates/core", version = "0.13" } git-next-forge-forgejo = { path = "crates/forge-forgejo", version = "0.13" } git-next-forge-github = { path = "crates/forge-github", version = "0.13" } +# TUI +ratatui = "0.28" + # CLI parsing clap = { version = "4.5", features = ["cargo", "derive"] } diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index e068f14..affe9c0 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -12,15 +12,19 @@ keywords = { workspace = true } categories = { workspace = true } [features] -default = ["forgejo", "github"] +default = ["forgejo", "github", "tui"] forgejo = ["git-next-forge-forgejo"] github = ["git-next-forge-github"] +tui = ["ratatui"] [dependencies] git-next-core = { workspace = true } git-next-forge-forgejo = { workspace = true, optional = true } git-next-forge-github = { workspace = true, optional = true } +# TUI +ratatui = { workspace = true, optional = true } + # CLI parsing clap = { workspace = true } diff --git a/crates/cli/src/alerts/mod.rs b/crates/cli/src/alerts/mod.rs index fdc8f0b..f3c47d6 100644 --- a/crates/cli/src/alerts/mod.rs +++ b/crates/cli/src/alerts/mod.rs @@ -36,17 +36,17 @@ fn short_message(user_notification: &UserNotification) -> String { repo_alias, commit, log: _, - } => format!("CI Check Failed: {forge_alias}/{repo_alias}: {commit}"), + } => format!("{forge_alias}/{repo_alias}: CI Check Failed: {commit}"), UserNotification::RepoConfigLoadFailure { forge_alias, repo_alias, reason: _, - } => format!("Invalid Repo Config: {forge_alias}/{repo_alias}"), + } => format!("{forge_alias}/{repo_alias}: Invalid Repo Config"), UserNotification::WebhookRegistration { forge_alias, repo_alias, reason: _, - } => format!("Failed Webhook Registration: {forge_alias}/{repo_alias}"), + } => format!("{forge_alias}/{repo_alias}: Failed Webhook Registration"), UserNotification::DevNotBasedOnMain { forge_alias, repo_alias, @@ -55,7 +55,7 @@ fn short_message(user_notification: &UserNotification) -> String { dev_commit: _, main_commit: _, log: _, - } => format!("Dev not based on Main: {forge_alias}/{repo_alias}"), + } => format!("{forge_alias}/{repo_alias}: Dev not based on Main"), }; format!("[git-next] {tail}") } diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 8b8f021..6ae3491 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -1,4 +1,7 @@ // +#[cfg(feature = "tui")] +mod tui; + mod alerts; mod file_watcher; mod forge; diff --git a/crates/cli/src/tui/mod.rs b/crates/cli/src/tui/mod.rs new file mode 100644 index 0000000..e69de29