From 96557d1a837ef5d9072488b4b6195d0bbd84f7f4 Mon Sep 17 00:00:00 2001 From: Simon Guest Date: Thu, 27 Jun 2024 12:20:56 +1200 Subject: [PATCH] Update for Nu 0.95 New metadata call with version field Fixes #20 --- .github/workflows/test-suite.yml | 2 +- README.md | 1 + api/Cargo.lock | 76 ++++++++++++++++++++++---------- api/Cargo.toml | 6 +-- api/src/main.rs | 4 ++ nu_plugin_bash_env | 22 ++++++++- 6 files changed, 83 insertions(+), 28 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 143af1b..e18b6a4 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -1,7 +1,7 @@ name: test suite on: [push, pull_request] env: - NU_VERSION: 0.94.1 + NU_VERSION: 0.95.0 jobs: test: diff --git a/README.md b/README.md index 019471e..d5b681d 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ The following versions are compatible. | 0.93 | 0.8.0 | | 0.93 | 0.9.0 | | 0.94 | 0.10.0 | +| 0.95 | 0.11.0 | If you find a new version of Nushell rejects this plugin as incompatible, please report an [issue](https://github.com/tesujimath/nu_plugin_bash_env/issues). diff --git a/api/Cargo.lock b/api/Cargo.lock index b5a78fb..484b33b 100644 --- a/api/Cargo.lock +++ b/api/Cargo.lock @@ -307,6 +307,15 @@ dependencies = [ "libloading", ] +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation-sys" version = "0.8.6" @@ -518,9 +527,9 @@ dependencies = [ [[package]] name = "interprocess" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13f2533e1f1a70bec71ea7a85d1c0a4dab141c314035ce76e51a19a2f48be708" +checksum = "67bafc2f5dbdad79a6d925649758d5472647b416028099f0b829d1b67fdd47d3" dependencies = [ "doctest-file", "libc", @@ -743,11 +752,24 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "nu-derive-value" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9724b3754a25b2f8a2a7f1530e0a162fa57a3cadd0b5c3b52f75edcdb2070c09" +dependencies = [ + "convert_case", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.58", +] + [[package]] name = "nu-engine" -version = "0.94.1" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22fb3bd460654e011259e834050794f9123a51493663e09aefe5dfb937b408a8" +checksum = "f5ed7cd7d34dd3e58292eaaa658f4b7342da99e979da54babd50c08d5d6d59e5" dependencies = [ "nu-glob", "nu-path", @@ -757,15 +779,15 @@ dependencies = [ [[package]] name = "nu-glob" -version = "0.94.1" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bb69b3a1152ec28a2bb35264e93a66b5028f1137e52cf6a29026742b9a46cc3" +checksum = "acd2879444c53bbfb51a2ab060ae1257fe2c8446e6b2cd8a63c88a4d6a728a7a" [[package]] name = "nu-path" -version = "0.94.1" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bdfba442db75e61616d8a017a392301c3619c1dbbe92ee291b4ac0072c3e56d" +checksum = "6633f681c4c92d86198d91f3a4b212e64a33901ca492dd5529631c8ac7dd6ca9" dependencies = [ "dirs-next", "omnipath", @@ -774,9 +796,9 @@ dependencies = [ [[package]] name = "nu-plugin" -version = "0.94.1" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac87b13cca366fcf36db31e5e2c66b6ea5a791d161314f4b34f9166604718471" +checksum = "b7844c84c9319c0dc831bc6d595990dee2ba66aab9d0a0d4d64ab414e6520b0f" dependencies = [ "log", "nix", @@ -789,9 +811,9 @@ dependencies = [ [[package]] name = "nu-plugin-core" -version = "0.94.1" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be7eb2ad0fbb7d5006211fafa25c421082ff3b098e4395e173386790a7ea1ab" +checksum = "b400723e072a53a1ddff07f530758b17df97cb8bf632414c547a1ad2c1225ddb" dependencies = [ "interprocess", "log", @@ -805,9 +827,9 @@ dependencies = [ [[package]] name = "nu-plugin-protocol" -version = "0.94.1" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f0da1070ae49e5d203163457e527f7f84380f6a0cfda5d2878181e147692b5" +checksum = "257069f3d77a7fbe47685deb3a53d2de4a4744f6869a7f977286dbadd8bdb2aa" dependencies = [ "bincode", "nu-protocol", @@ -819,19 +841,21 @@ dependencies = [ [[package]] name = "nu-protocol" -version = "0.94.1" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36e2198a52b43e5f0208bec96de68a72a41f076b2b5b1e5e03b6725441060799" +checksum = "f83d22636a014d5db9f894db2e53fac656b686a35f1002ecc1b8b46b47474874" dependencies = [ "brotli", "byte-unit", "chrono", "chrono-humanize", + "convert_case", "fancy-regex", "indexmap", "lru", "miette", "nix", + "nu-derive-value", "nu-path", "nu-system", "nu-utils", @@ -845,9 +869,9 @@ dependencies = [ [[package]] name = "nu-system" -version = "0.94.1" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b103a4c5abcf6ce9c0e395ed9959486cfd6691f21f8cf128ffd2b35130bd0bb5" +checksum = "8c5e86b4e9ea84b4b12778a159adbbef5f4346213dcc4e9e58f3c40f5c9865af" dependencies = [ "chrono", "itertools", @@ -865,9 +889,9 @@ dependencies = [ [[package]] name = "nu-utils" -version = "0.94.1" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c572ba7a4ee47481f0b011114fbeb25b6171bc194d689c034b410db61d3c6d2c" +checksum = "bc747ba17d4762480a7569df44b49fb7f465b12b98aaa2a18aab2eeb585df79c" dependencies = [ "crossterm_winapi", "log", @@ -882,7 +906,7 @@ dependencies = [ [[package]] name = "nu_plugin_bash_env_api" -version = "0.10.0" +version = "0.11.0" dependencies = [ "nu-plugin", "nu-protocol", @@ -921,9 +945,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "os_pipe" -version = "1.1.5" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57119c3b893986491ec9aa85056780d3a0f3cf4da7cc09dd3650dbd6c6738fb9" +checksum = "29d73ba8daf8fac13b0501d1abeddcfe21ba7401ada61a819144b6c2a4f32209" dependencies = [ "libc", "windows-sys 0.52.0", @@ -1535,6 +1559,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + [[package]] name = "unicode-width" version = "0.1.11" diff --git a/api/Cargo.toml b/api/Cargo.toml index 722e6d6..204d9f0 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu_plugin_bash_env_api" -version = "0.10.0" +version = "0.11.0" edition = "2021" license = "MIT" description = "API for Nu plugin bash-env" @@ -9,5 +9,5 @@ repository = "https://github.com/tesujimath/nu_plugin_bash_env" readme = "README.md" [dependencies] -nu-plugin = "0.94.1" -nu-protocol = "0.94.1" +nu-plugin = "0.95.0" +nu-protocol = "0.95.0" diff --git a/api/src/main.rs b/api/src/main.rs index 7d24f3c..6f121cf 100644 --- a/api/src/main.rs +++ b/api/src/main.rs @@ -10,6 +10,10 @@ impl Plugin for BashEnvApiPlugin { fn commands(&self) -> Vec>> { vec![Box::new(BashEnvApi)] } + + fn version(&self) -> String { + env!("CARGO_PKG_VERSION").to_string() + } } struct BashEnvApi; diff --git a/nu_plugin_bash_env b/nu_plugin_bash_env index 4029718..69b5f73 100755 --- a/nu_plugin_bash_env +++ b/nu_plugin_bash_env @@ -22,7 +22,8 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -PROTOCOL_VERSION="0.94.1" +VERSION="0.11.0" +PROTOCOL_VERSION="0.95.0" shopt -s extglob @@ -42,6 +43,22 @@ function send_hello() { EOF } +function send_metadata() { + _call_id="$1" + jq -c <