From c0fbb0ff254ab81d4b37e327e8efb891ce5b2c3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20Pe=CC=81rez?= Date: Sat, 20 Sep 2025 15:49:11 +0100 Subject: [PATCH] chore: update code to latest dependencies and Nushell --- Cargo.lock | 252 +++++++++++++++--------- Cargo.toml | 14 +- README.md | 485 ++++++++++++++++++++++++++++++++++++++++++++--- nu_plugin_fluent | 1 + src/main.rs | 2 +- 5 files changed, 633 insertions(+), 121 deletions(-) create mode 160000 nu_plugin_fluent diff --git a/Cargo.lock b/Cargo.lock index ec2a7ef..6f8219b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -144,6 +144,15 @@ dependencies = [ "serde", ] +[[package]] +name = "buf-trait" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21eaafc770e8c073d6c3facafe7617e774305d4954aa6351b9c452eb37ee17b4" +dependencies = [ + "zerocopy 0.7.35", +] + [[package]] name = "bumpalo" version = "3.19.0" @@ -164,9 +173,27 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "bytesize" -version = "1.3.3" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e93abca9e28e0a1b9877922aacb20576e05d4679ffa78c3d6dc22a26a216659" +checksum = "f5c434ae3cf0089ca203e9019ebe529c47ff45cefe8af7c85ecb734ef541822f" + +[[package]] +name = "byteyarn" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b93e51d26468a15ea59f8525e0c13dc405db43e644a0b1e6d44346c72cf4cf7b" +dependencies = [ + "buf-trait", +] + +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] [[package]] name = "cc" @@ -444,9 +471,9 @@ dependencies = [ [[package]] name = "fancy-regex" -version = "0.14.0" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e24cb5a94bcae1e5408b0effca5cd7172ea3c5755049c5f3af4cd283a165298" +checksum = "998b056554fbe42e03ae0e152895cd1a7e1002aec800fdc6635d20270260c46f" dependencies = [ "bit-set", "regex-automata", @@ -594,9 +621,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.9.0" +version = "2.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" dependencies = [ "equivalent", "hashbrown", @@ -676,6 +703,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "lean_string" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "962df00ba70ac8d5ca5c064e17e5c3d090c087fd8d21aa45096c716b169da514" +dependencies = [ + "castaway", + "itoa", + "ryu", + "serde", +] + [[package]] name = "libc" version = "0.2.174" @@ -878,7 +917,7 @@ dependencies = [ [[package]] name = "nu-cmd-base" -version = "0.105.2" +version = "0.107.1" dependencies = [ "indexmap", "miette", @@ -890,11 +929,12 @@ dependencies = [ [[package]] name = "nu-cmd-lang" -version = "0.105.2" +version = "0.107.1" dependencies = [ "itertools 0.14.0", "nu-cmd-base", "nu-engine", + "nu-experimental", "nu-parser", "nu-protocol", "nu-utils", @@ -903,7 +943,7 @@ dependencies = [ [[package]] name = "nu-derive-value" -version = "0.105.2" +version = "0.107.1" dependencies = [ "heck", "proc-macro-error2", @@ -914,22 +954,32 @@ dependencies = [ [[package]] name = "nu-engine" -version = "0.105.2" +version = "0.107.1" dependencies = [ + "fancy-regex", "log", + "nu-experimental", "nu-glob", "nu-path", "nu-protocol", "nu-utils", ] +[[package]] +name = "nu-experimental" +version = "0.107.1" +dependencies = [ + "itertools 0.14.0", + "thiserror 2.0.12", +] + [[package]] name = "nu-glob" -version = "0.105.2" +version = "0.107.1" [[package]] name = "nu-parser" -version = "0.105.2" +version = "0.107.1" dependencies = [ "bytesize", "chrono", @@ -945,7 +995,7 @@ dependencies = [ [[package]] name = "nu-path" -version = "0.105.2" +version = "0.107.1" dependencies = [ "dirs", "omnipath", @@ -955,7 +1005,7 @@ dependencies = [ [[package]] name = "nu-plugin" -version = "0.105.2" +version = "0.107.1" dependencies = [ "log", "nix", @@ -969,7 +1019,7 @@ dependencies = [ [[package]] name = "nu-plugin-core" -version = "0.105.2" +version = "0.107.1" dependencies = [ "interprocess", "log", @@ -983,7 +1033,7 @@ dependencies = [ [[package]] name = "nu-plugin-engine" -version = "0.105.2" +version = "0.107.1" dependencies = [ "log", "nu-engine", @@ -998,7 +1048,7 @@ dependencies = [ [[package]] name = "nu-plugin-protocol" -version = "0.105.2" +version = "0.107.1" dependencies = [ "nu-protocol", "nu-utils", @@ -1010,7 +1060,7 @@ dependencies = [ [[package]] name = "nu-plugin-test-support" -version = "0.105.2" +version = "0.107.1" dependencies = [ "nu-ansi-term", "nu-cmd-lang", @@ -1026,7 +1076,7 @@ dependencies = [ [[package]] name = "nu-protocol" -version = "0.105.2" +version = "0.107.1" dependencies = [ "brotli", "bytes", @@ -1043,6 +1093,7 @@ dependencies = [ "miette", "nix", "nu-derive-value", + "nu-experimental", "nu-glob", "nu-path", "nu-system", @@ -1063,7 +1114,7 @@ dependencies = [ [[package]] name = "nu-system" -version = "0.105.2" +version = "0.107.1" dependencies = [ "chrono", "itertools 0.14.0", @@ -1081,13 +1132,16 @@ dependencies = [ [[package]] name = "nu-utils" -version = "0.105.2" +version = "0.107.1" dependencies = [ + "byteyarn", "crossterm", "crossterm_winapi", "fancy-regex", + "lean_string", "log", "lscolors", + "memchr", "nix", "num-format", "serde", @@ -1142,6 +1196,25 @@ dependencies = [ "libc", ] +[[package]] +name = "objc2-core-foundation" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166" +dependencies = [ + "bitflags", +] + +[[package]] +name = "objc2-io-kit" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71c1c64d6120e51cd86033f67176b1cb66780c2efe34dec55176f77befd93c0a" +dependencies = [ + "libc", + "objc2-core-foundation", +] + [[package]] name = "omnipath" version = "0.1.6" @@ -1314,7 +1387,7 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy", + "zerocopy 0.8.26", ] [[package]] @@ -1428,26 +1501,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - [[package]] name = "recvmsg" version = "1.0.0" @@ -1655,9 +1708,9 @@ dependencies = [ [[package]] name = "shadow-rs" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6fd27df794ced2ef39872879c93a9f87c012607318af8621cd56d2c3a8b3a2" +checksum = "b8aa5c0570cd9654158bd39f0f8caba24edbc058313946e89f4648b1de1ecf49" dependencies = [ "const_format", "is_debug", @@ -1800,16 +1853,16 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.33.1" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc858248ea01b66f19d8e8a6d55f41deaf91e9d495246fd01368d99935c6c01" +checksum = "252800745060e7b9ffb7b2badbd8b31cfa4aa2e61af879d0a3bf2a317c20217d" dependencies = [ - "core-foundation-sys", "libc", "memchr", "ntapi", - "rayon", - "windows 0.57.0", + "objc2-core-foundation", + "objc2-io-kit", + "windows 0.61.3", ] [[package]] @@ -2229,12 +2282,24 @@ dependencies = [ [[package]] name = "windows" -version = "0.57.0" +version = "0.61.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" dependencies = [ - "windows-core 0.57.0", - "windows-targets 0.52.6", + "windows-collections", + "windows-core 0.61.2", + "windows-future", + "windows-link", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", ] [[package]] @@ -2249,18 +2314,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-core" -version = "0.57.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" -dependencies = [ - "windows-implement 0.57.0", - "windows-interface 0.57.0", - "windows-result 0.1.2", - "windows-targets 0.52.6", -] - [[package]] name = "windows-core" version = "0.61.2" @@ -2275,21 +2328,21 @@ dependencies = [ ] [[package]] -name = "windows-implement" -version = "0.56.0" +name = "windows-future" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6fc35f58ecd95a9b71c4f2329b911016e6bec66b3f2e6a4aad86bd2e99e2f9b" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ - "proc-macro2", - "quote", - "syn", + "windows-core 0.61.2", + "windows-link", + "windows-threading", ] [[package]] name = "windows-implement" -version = "0.57.0" +version = "0.56.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +checksum = "f6fc35f58ecd95a9b71c4f2329b911016e6bec66b3f2e6a4aad86bd2e99e2f9b" dependencies = [ "proc-macro2", "quote", @@ -2318,17 +2371,6 @@ dependencies = [ "syn", ] -[[package]] -name = "windows-interface" -version = "0.57.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "windows-interface" version = "0.59.1" @@ -2346,6 +2388,16 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link", +] + [[package]] name = "windows-result" version = "0.1.2" @@ -2456,6 +2508,15 @@ dependencies = [ "windows_x86_64_msvc 0.53.0", ] +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -2594,13 +2655,34 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive 0.7.35", +] + [[package]] name = "zerocopy" version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.8.26", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 7e75cfa..6c0d967 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,13 +12,13 @@ license = "MIT" [dependencies] # for local development, you can use a path dependency -nu-plugin = { path = "../nushell/crates/nu-plugin" } -nu-protocol = { path = "../nushell/crates/nu-protocol", features = ["plugin"] } +nu-plugin = { version = "0.107.1", path = "../nushell/crates/nu-plugin" } +nu-protocol = { version = "0.107.1", path = "../nushell/crates/nu-protocol", features = ["plugin"] } #nu-plugin = "0.104.0" -#nu-protocol = { version = "0.104.0", features = ["plugin"] } -tera = "1.3" -serde_json = "1.0" +#nu-protocol = { version = "0.107.1", version = "0.107.1", features = ["plugin"] } +tera = "1.20" +serde_json = "1.0" [dev-dependencies] -nu-plugin-test-support = { path = "../nushell/crates/nu-plugin-test-support" } -#nu-plugin-test-support = { version = "0.104.0" } +nu-plugin-test-support = { version = "0.107.1", path = "../nushell/crates/nu-plugin-test-support" } +#nu-plugin-test-support = { version = "0.107.1", version = "0.107.1" } \ No newline at end of file diff --git a/README.md b/README.md index 0f625f6..f300d96 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,32 @@ # nu_plugin_tera -A [Nushell](https://nushell.sh/) plugin to use [Tera templates](https://keats.github.io/tera/docs/). +A powerful [Nushell](https://nushell.sh/) plugin for rendering [Tera templates](https://keats.github.io/tera/docs/) with structured data from Nushell pipelines. + +## Overview + +This plugin integrates Mozilla's Tera templating engine with Nushell, enabling you to generate dynamic content from structured data. Perfect for configuration files, documentation generation, reports, and any scenario where you need to combine templates with data. ## Installing -Clone this repository +Clone this repository -> [!WARNING] +> [!WARNING] > **nu_plugin_tera** has dependencies to nushell source via local path in Cargo.toml -> Nushell and plugins require to be **sync** with same **version** +> Nushell and plugins require to be **sync** with same **version** -Clone [Nushell](https://nushell.sh/) to plugin to use [Tera templates](https://keats.github.io/tera/docs/) or change dependecies in [Cargo.toml](Cargo.toml) +Clone [Nushell](https://nushell.sh/) alongside this plugin or change dependencies in [Cargo.toml](Cargo.toml) -This plugin is also included as submodule in [nushell-plugins](https://repo.jesusperez.pro/jesus/nushell-plugins) +This plugin is also included as submodule in [nushell-plugins](https://repo.jesusperez.pro/jesus/nushell-plugins) as part of plugins collection for [Provisioning project](https://rlung.librecloud.online/jesus/provisioning) -Build from source +Build from source ```nushell > cd nu_plugin_tera > cargo install --path . ``` -### Nushell +### Nushell In a [Nushell](https://nushell.sh/) @@ -30,24 +34,68 @@ In a [Nushell](https://nushell.sh/) > plugin add ~/.cargo/bin/nu_plugin_tera ``` -## Usage +## Commands + +### `tera-render` + +Render Tera templates with structured data from Nushell pipelines or arguments. ```nushell -> tera-render