diff --git a/Cargo.lock b/Cargo.lock index 8c855857..047c015a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1428,6 +1428,8 @@ dependencies = [ "lazy_static", "libc", "log", + "maplit", + "ncurses", "signal-hook", "tokio 1.28.2", "unicode-segmentation", @@ -3229,6 +3231,17 @@ dependencies = [ "socket2 0.4.9", ] +[[package]] +name = "ncurses" +version = "5.101.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2c5d34d72657dc4b638a1c25d40aae81e4f1c699062f72f467237920752032" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "ndk" version = "0.7.0" diff --git a/external/cursive b/external/cursive index 31ea07fd..250d35f3 160000 --- a/external/cursive +++ b/external/cursive @@ -1 +1 @@ -Subproject commit 31ea07fde2191be2ff8eb7c46c6fc2a1bfd8e311 +Subproject commit 250d35f37f526221539c8d59d7a2056803bf0010 diff --git a/veilid-cli/Cargo.toml b/veilid-cli/Cargo.toml index ce11242e..9bbd9784 100644 --- a/veilid-cli/Cargo.toml +++ b/veilid-cli/Cargo.toml @@ -16,7 +16,6 @@ rt-async-std = [ "async-std", "veilid-core/rt-async-std", "cursive/rt-async-std" rt-tokio = [ "tokio", "tokio-util", "veilid-core/rt-tokio", "cursive/rt-tokio" ] [dependencies] -cursive = { path = "../external/cursive/cursive", default-features = false, features = [ "crossterm", "toml", "ansi" ]} async-std = { version = "^1.9", features = ["unstable", "attributes"], optional = true } tokio = { version = "^1", features = ["full"], optional = true } tokio-util = { version = "^0", features = ["compat"], optional = true} @@ -46,6 +45,12 @@ hex = "^0" veilid-core = { path = "../veilid-core" } json = "^0" +[target.'cfg(not(target_os = "macos"))'.dependencies] +cursive = { path = "../external/cursive/cursive", default-features = false, features = [ "crossterm", "toml", "ansi" ]} + +[target.'cfg(target_os = "macos")'.dependencies] +cursive = { path = "../external/cursive/cursive", default-features = false, features = [ "ncurses-backend", "toml", "ansi" ]} + [dev-dependencies] serial_test = "^0" diff --git a/veilid-cli/src/ui.rs b/veilid-cli/src/ui.rs index 0d217823..5fa5a2dc 100644 --- a/veilid-cli/src/ui.rs +++ b/veilid-cli/src/ui.rs @@ -709,7 +709,10 @@ impl UI { // Instantiate the cursive runnable let runnable = CursiveRunnable::new( - || -> Result, Box> { + || -> Result, Box> { + #[cfg(target_os = "macos")] + let backend = cursive::backends::curses::n::Backend::init().unwrap(); + #[cfg(not(target_os = "macos"))] let backend = cursive::backends::crossterm::Backend::init().unwrap(); let buffered_backend = cursive_buffered_backend::BufferedBackend::new(backend); Ok(Box::new(buffered_backend))