From 3d9314a908c6989d52e684afeea643cab4e6cdc2 Mon Sep 17 00:00:00 2001 From: Carlos Rueda Date: Tue, 31 Oct 2023 15:58:38 -0700 Subject: [PATCH] update rustyline --- Cargo.lock | 106 ++++++++-------------------------------------------- Cargo.toml | 2 +- README.md | 1 + justfile | 8 ++++ src/main.rs | 6 +-- 5 files changed, 28 insertions(+), 95 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0fcc5a7..a2b3983 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,12 +50,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - [[package]] name = "bitflags" version = "1.3.2" @@ -148,27 +142,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "endian-type" version = "0.1.2" @@ -217,17 +190,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "getrandom" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "heck" version = "0.4.1" @@ -240,6 +202,15 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys", +] + [[package]] name = "is-terminal" version = "0.4.9" @@ -292,11 +263,10 @@ dependencies = [ [[package]] name = "nix" -version = "0.25.1" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" dependencies = [ - "autocfg", "bitflags 1.3.2", "cfg-if", "libc", @@ -330,26 +300,6 @@ dependencies = [ "nibble_vec", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall", - "thiserror", -] - [[package]] name = "rustix" version = "0.38.21" @@ -365,15 +315,15 @@ dependencies = [ [[package]] name = "rustyline" -version = "10.1.1" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e83c32c3f3c33b08496e0d1df9ea8c64d39adb8eb36a1ebb1440c690697aef" +checksum = "994eca4bca05c87e86e15d90fc7a91d1be64b4482b38cb2d27474568fe7c9db9" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.1", "cfg-if", "clipboard-win", - "dirs-next", "fd-lock", + "home", "libc", "log", "memchr", @@ -421,26 +371,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "thiserror" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "unicode-ident" version = "1.0.12" @@ -465,12 +395,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 9780ccb..ef75f57 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,4 +11,4 @@ anstyle = "1.0.1" # for coloring clap help clap = { version = "4.3.10", features = ["derive", "unstable-styles"] } colored = "2.0.4" -rustyline = "10.1.1" +rustyline = "12.0.0" diff --git a/README.md b/README.md index 4a3e0b5..f180c7a 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ See a quick demo [here](demo/index.md). ## Change log +- 2023-10: rustyline updated - 2023-06: just some dep updates - 2022-11-13: do various dep updates and set 2021 edition - 2022-09-17: fix #1 to address critical dependabot notification diff --git a/justfile b/justfile index 900afc7..95ebd3c 100644 --- a/justfile +++ b/justfile @@ -8,6 +8,14 @@ dev: test format # dev + clippy; good to run before committing changes all: dev clippy +# cargo watch +watch *cmd='check': + cargo watch -c -x '{{ cmd }}' + +# cargo check +check: + cargo check + # Run tests test: cargo test diff --git a/src/main.rs b/src/main.rs index 0992fb1..0e0c698 100644 --- a/src/main.rs +++ b/src/main.rs @@ -154,14 +154,14 @@ fn stdin_loop( to_server: &TcpStream, from_server_thread: thread::JoinHandle<()>, ) -> Result<()> { - let mut rl = Editor::<()>::new()?; // `()` can be used when no completer is required + let mut rl = Editor::<(), _>::new()?; // `()` can be used when no completer is required if rl.load_history(HISTORY_FILE).is_err() { println!("{}", "(no previous history)".bright_black()); } send_line(&opts.name, to_server, opts.debug); if !opts.cmd.trim().is_empty() { - rl.add_history_entry(&opts.cmd); + let _ = rl.add_history_entry(&opts.cmd); send_line(&opts.cmd, to_server, opts.debug); } @@ -175,7 +175,7 @@ fn stdin_loop( exit("exiting...", done_sender, from_server_thread); break; } else { - rl.add_history_entry(line); + let _ = rl.add_history_entry(line); send_line(line, to_server, opts.debug); } }