merging main
This commit is contained in:
commit
5c32e8a0d4
2
.github/workflows/nightly-build.yml
vendored
2
.github/workflows/nightly-build.yml
vendored
|
@ -161,7 +161,7 @@ jobs:
|
|||
# REF: https://github.com/marketplace/actions/gh-release
|
||||
# Create a release only in nushell/nightly repo
|
||||
- name: Publish Archive
|
||||
uses: softprops/action-gh-release@v2.0.5
|
||||
uses: softprops/action-gh-release@v2.0.6
|
||||
if: ${{ startsWith(github.repository, 'nushell/nightly') }}
|
||||
with:
|
||||
prerelease: true
|
||||
|
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -91,7 +91,7 @@ jobs:
|
|||
|
||||
# REF: https://github.com/marketplace/actions/gh-release
|
||||
- name: Publish Archive
|
||||
uses: softprops/action-gh-release@v2.0.5
|
||||
uses: softprops/action-gh-release@v2.0.6
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
with:
|
||||
draft: true
|
||||
|
|
2
.github/workflows/typos.yml
vendored
2
.github/workflows/typos.yml
vendored
|
@ -10,4 +10,4 @@ jobs:
|
|||
uses: actions/checkout@v4.1.7
|
||||
|
||||
- name: Check spelling
|
||||
uses: crate-ci/typos@v1.22.7
|
||||
uses: crate-ci/typos@v1.22.9
|
||||
|
|
106
Cargo.lock
generated
106
Cargo.lock
generated
|
@ -377,7 +377,7 @@ dependencies = [
|
|||
"bitflags 2.5.0",
|
||||
"cexpr",
|
||||
"clang-sys",
|
||||
"itertools 0.12.1",
|
||||
"itertools 0.11.0",
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"proc-macro2",
|
||||
|
@ -2024,12 +2024,6 @@ dependencies = [
|
|||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indoc"
|
||||
version = "2.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
|
||||
|
||||
[[package]]
|
||||
name = "inotify"
|
||||
version = "0.9.6"
|
||||
|
@ -2798,7 +2792,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"assert_cmd",
|
||||
"crossterm",
|
||||
|
@ -2851,7 +2845,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-cli"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"crossterm",
|
||||
|
@ -2886,7 +2880,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-cmd-base"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"miette",
|
||||
|
@ -2898,7 +2892,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-cmd-extra"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"fancy-regex",
|
||||
"heck 0.5.0",
|
||||
|
@ -2923,7 +2917,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-cmd-lang"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"itertools 0.12.1",
|
||||
"nu-engine",
|
||||
|
@ -2935,7 +2929,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-cmd-plugin"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"itertools 0.12.1",
|
||||
"nu-engine",
|
||||
|
@ -2946,7 +2940,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-color-config"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"nu-ansi-term",
|
||||
"nu-engine",
|
||||
|
@ -2958,7 +2952,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-command"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"alphanumeric-sort",
|
||||
"base64 0.22.1",
|
||||
|
@ -3067,7 +3061,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-derive-value"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"convert_case",
|
||||
"proc-macro-error",
|
||||
|
@ -3078,7 +3072,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-engine"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"nu-glob",
|
||||
"nu-path",
|
||||
|
@ -3088,7 +3082,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-explore"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"ansi-str",
|
||||
"anyhow",
|
||||
|
@ -3113,14 +3107,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-glob"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"doc-comment",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nu-json"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"linked-hash-map",
|
||||
"num-traits",
|
||||
|
@ -3130,7 +3124,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-lsp"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"assert-json-diff",
|
||||
"crossbeam-channel",
|
||||
|
@ -3151,7 +3145,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-parser"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"bytesize",
|
||||
"chrono",
|
||||
|
@ -3167,7 +3161,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-path"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"dirs-next",
|
||||
"omnipath",
|
||||
|
@ -3176,7 +3170,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-plugin"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"log",
|
||||
"nix",
|
||||
|
@ -3191,7 +3185,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-plugin-core"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"interprocess",
|
||||
"log",
|
||||
|
@ -3205,7 +3199,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-plugin-engine"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"log",
|
||||
"nu-engine",
|
||||
|
@ -3220,7 +3214,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-plugin-protocol"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"nu-protocol",
|
||||
|
@ -3232,7 +3226,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-plugin-test-support"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"nu-ansi-term",
|
||||
"nu-cmd-lang",
|
||||
|
@ -3250,7 +3244,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-pretty-hex"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"heapless",
|
||||
"nu-ansi-term",
|
||||
|
@ -3259,7 +3253,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-protocol"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"brotli",
|
||||
"byte-unit",
|
||||
|
@ -3292,7 +3286,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-std"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"log",
|
||||
"miette",
|
||||
|
@ -3303,7 +3297,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-system"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"itertools 0.12.1",
|
||||
|
@ -3321,7 +3315,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-table"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"fancy-regex",
|
||||
"nu-ansi-term",
|
||||
|
@ -3335,7 +3329,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-term-grid"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"nu-utils",
|
||||
"unicode-width",
|
||||
|
@ -3343,7 +3337,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-test-support"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"nu-glob",
|
||||
"nu-path",
|
||||
|
@ -3355,7 +3349,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu-utils"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"crossterm_winapi",
|
||||
"log",
|
||||
|
@ -3381,7 +3375,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu_plugin_example"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"nu-cmd-lang",
|
||||
"nu-plugin",
|
||||
|
@ -3391,7 +3385,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu_plugin_formats"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"eml-parser",
|
||||
"ical",
|
||||
|
@ -3404,7 +3398,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu_plugin_gstat"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"git2",
|
||||
"nu-plugin",
|
||||
|
@ -3413,7 +3407,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu_plugin_inc"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"nu-plugin",
|
||||
"nu-protocol",
|
||||
|
@ -3422,7 +3416,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu_plugin_polars"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"chrono-tz 0.9.0",
|
||||
|
@ -3456,7 +3450,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu_plugin_query"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"gjson",
|
||||
"nu-plugin",
|
||||
|
@ -3468,7 +3462,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nu_plugin_stress_internals"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"interprocess",
|
||||
"serde",
|
||||
|
@ -3594,7 +3588,7 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
|
|||
|
||||
[[package]]
|
||||
name = "nuon"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"fancy-regex",
|
||||
|
@ -4784,21 +4778,21 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ratatui"
|
||||
version = "0.26.2"
|
||||
version = "0.26.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a564a852040e82671dc50a37d88f3aa83bbc690dfc6844cfe7a2591620206a80"
|
||||
checksum = "f44c9e68fd46eda15c646fbb85e1040b657a58cdc8c98db1d97a55930d991eef"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"cassowary",
|
||||
"compact_str",
|
||||
"crossterm",
|
||||
"indoc",
|
||||
"itertools 0.12.1",
|
||||
"lru",
|
||||
"paste",
|
||||
"stability",
|
||||
"strum",
|
||||
"unicode-segmentation",
|
||||
"unicode-truncate",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
|
@ -5473,9 +5467,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "shadow-rs"
|
||||
version = "0.28.0"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d75516bdaee8f640543ad1f6e292448c23ce57143f812c3736ab4b0874383df"
|
||||
checksum = "0a600f795d0894cda22235b44eea4b85c2a35b405f65523645ac8e35b306817a"
|
||||
dependencies = [
|
||||
"const_format",
|
||||
"is_debug",
|
||||
|
@ -6346,6 +6340,16 @@ version = "1.11.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-truncate"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a5fbabedabe362c618c714dbefda9927b5afc8e2a8102f47f081089a9019226"
|
||||
dependencies = [
|
||||
"itertools 0.12.1",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.12"
|
||||
|
@ -6525,9 +6529,9 @@ checksum = "425a23c7b7145bc7620c9c445817c37b1f78b6790aee9f208133f3c028975b60"
|
|||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.8.0"
|
||||
version = "1.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0"
|
||||
checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"serde",
|
||||
|
|
42
Cargo.toml
42
Cargo.toml
|
@ -11,7 +11,7 @@ license = "MIT"
|
|||
name = "nu"
|
||||
repository = "https://github.com/nushell/nushell"
|
||||
rust-version = "1.77.2"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
@ -172,7 +172,7 @@ uu_mv = "0.0.26"
|
|||
uu_whoami = "0.0.26"
|
||||
uu_uname = "0.0.26"
|
||||
uucore = "0.0.26"
|
||||
uuid = "1.8.0"
|
||||
uuid = "1.9.1"
|
||||
v_htmlescape = "0.15.0"
|
||||
wax = "0.6"
|
||||
which = "6.0.0"
|
||||
|
@ -180,22 +180,22 @@ windows = "0.54"
|
|||
winreg = "0.52"
|
||||
|
||||
[dependencies]
|
||||
nu-cli = { path = "./crates/nu-cli", version = "0.95.0" }
|
||||
nu-cmd-base = { path = "./crates/nu-cmd-base", version = "0.95.0" }
|
||||
nu-cmd-lang = { path = "./crates/nu-cmd-lang", version = "0.95.0" }
|
||||
nu-cmd-plugin = { path = "./crates/nu-cmd-plugin", version = "0.95.0", optional = true }
|
||||
nu-cmd-extra = { path = "./crates/nu-cmd-extra", version = "0.95.0" }
|
||||
nu-command = { path = "./crates/nu-command", version = "0.95.0" }
|
||||
nu-engine = { path = "./crates/nu-engine", version = "0.95.0" }
|
||||
nu-explore = { path = "./crates/nu-explore", version = "0.95.0" }
|
||||
nu-lsp = { path = "./crates/nu-lsp/", version = "0.95.0" }
|
||||
nu-parser = { path = "./crates/nu-parser", version = "0.95.0" }
|
||||
nu-path = { path = "./crates/nu-path", version = "0.95.0" }
|
||||
nu-plugin-engine = { path = "./crates/nu-plugin-engine", optional = true, version = "0.95.0" }
|
||||
nu-protocol = { path = "./crates/nu-protocol", version = "0.95.0" }
|
||||
nu-std = { path = "./crates/nu-std", version = "0.95.0" }
|
||||
nu-system = { path = "./crates/nu-system", version = "0.95.0" }
|
||||
nu-utils = { path = "./crates/nu-utils", version = "0.95.0" }
|
||||
nu-cli = { path = "./crates/nu-cli", version = "0.95.1" }
|
||||
nu-cmd-base = { path = "./crates/nu-cmd-base", version = "0.95.1" }
|
||||
nu-cmd-lang = { path = "./crates/nu-cmd-lang", version = "0.95.1" }
|
||||
nu-cmd-plugin = { path = "./crates/nu-cmd-plugin", version = "0.95.1", optional = true }
|
||||
nu-cmd-extra = { path = "./crates/nu-cmd-extra", version = "0.95.1" }
|
||||
nu-command = { path = "./crates/nu-command", version = "0.95.1" }
|
||||
nu-engine = { path = "./crates/nu-engine", version = "0.95.1" }
|
||||
nu-explore = { path = "./crates/nu-explore", version = "0.95.1" }
|
||||
nu-lsp = { path = "./crates/nu-lsp/", version = "0.95.1" }
|
||||
nu-parser = { path = "./crates/nu-parser", version = "0.95.1" }
|
||||
nu-path = { path = "./crates/nu-path", version = "0.95.1" }
|
||||
nu-plugin-engine = { path = "./crates/nu-plugin-engine", optional = true, version = "0.95.1" }
|
||||
nu-protocol = { path = "./crates/nu-protocol", version = "0.95.1" }
|
||||
nu-std = { path = "./crates/nu-std", version = "0.95.1" }
|
||||
nu-system = { path = "./crates/nu-system", version = "0.95.1" }
|
||||
nu-utils = { path = "./crates/nu-utils", version = "0.95.1" }
|
||||
|
||||
reedline = { workspace = true, features = ["bashisms", "sqlite"] }
|
||||
|
||||
|
@ -225,9 +225,9 @@ nix = { workspace = true, default-features = false, features = [
|
|||
] }
|
||||
|
||||
[dev-dependencies]
|
||||
nu-test-support = { path = "./crates/nu-test-support", version = "0.95.0" }
|
||||
nu-plugin-protocol = { path = "./crates/nu-plugin-protocol", version = "0.95.0" }
|
||||
nu-plugin-core = { path = "./crates/nu-plugin-core", version = "0.95.0" }
|
||||
nu-test-support = { path = "./crates/nu-test-support", version = "0.95.1" }
|
||||
nu-plugin-protocol = { path = "./crates/nu-plugin-protocol", version = "0.95.1" }
|
||||
nu-plugin-core = { path = "./crates/nu-plugin-core", version = "0.95.1" }
|
||||
assert_cmd = "2.0"
|
||||
dirs-next = { workspace = true }
|
||||
tango-bench = "0.5"
|
||||
|
|
|
@ -5,27 +5,27 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-cli"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-cli"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
[dev-dependencies]
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.95.0" }
|
||||
nu-command = { path = "../nu-command", version = "0.95.0" }
|
||||
nu-test-support = { path = "../nu-test-support", version = "0.95.0" }
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.95.1" }
|
||||
nu-command = { path = "../nu-command", version = "0.95.1" }
|
||||
nu-test-support = { path = "../nu-test-support", version = "0.95.1" }
|
||||
rstest = { workspace = true, default-features = false }
|
||||
tempfile = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
nu-cmd-base = { path = "../nu-cmd-base", version = "0.95.0" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.0" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.0" }
|
||||
nu-plugin-engine = { path = "../nu-plugin-engine", version = "0.95.0", optional = true }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.0" }
|
||||
nu-color-config = { path = "../nu-color-config", version = "0.95.0" }
|
||||
nu-cmd-base = { path = "../nu-cmd-base", version = "0.95.1" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.1" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.1" }
|
||||
nu-plugin-engine = { path = "../nu-plugin-engine", version = "0.95.1", optional = true }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.1" }
|
||||
nu-color-config = { path = "../nu-color-config", version = "0.95.1" }
|
||||
nu-ansi-term = { workspace = true }
|
||||
reedline = { workspace = true, features = ["bashisms", "sqlite"] }
|
||||
|
||||
|
|
|
@ -5,15 +5,15 @@ edition = "2021"
|
|||
license = "MIT"
|
||||
name = "nu-cmd-base"
|
||||
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-cmd-base"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.0" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.1" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
|
||||
indexmap = { workspace = true }
|
||||
miette = { workspace = true }
|
||||
|
|
|
@ -5,7 +5,7 @@ edition = "2021"
|
|||
license = "MIT"
|
||||
name = "nu-cmd-extra"
|
||||
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-cmd-extra"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
@ -13,13 +13,13 @@ version = "0.95.0"
|
|||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-cmd-base = { path = "../nu-cmd-base", version = "0.95.0" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0" }
|
||||
nu-json = { version = "0.95.0", path = "../nu-json" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.0" }
|
||||
nu-pretty-hex = { version = "0.95.0", path = "../nu-pretty-hex" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.0" }
|
||||
nu-cmd-base = { path = "../nu-cmd-base", version = "0.95.1" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1" }
|
||||
nu-json = { version = "0.95.1", path = "../nu-json" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.1" }
|
||||
nu-pretty-hex = { version = "0.95.1", path = "../nu-pretty-hex" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.1" }
|
||||
|
||||
# Potential dependencies for extras
|
||||
heck = { workspace = true }
|
||||
|
@ -33,6 +33,6 @@ v_htmlescape = { workspace = true }
|
|||
itertools = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.95.0" }
|
||||
nu-command = { path = "../nu-command", version = "0.95.0" }
|
||||
nu-test-support = { path = "../nu-test-support", version = "0.95.0" }
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.95.1" }
|
||||
nu-command = { path = "../nu-command", version = "0.95.1" }
|
||||
nu-test-support = { path = "../nu-test-support", version = "0.95.1" }
|
|
@ -6,22 +6,22 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-cmd-lang"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-cmd-lang"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.0" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.1" }
|
||||
|
||||
itertools = { workspace = true }
|
||||
shadow-rs = { version = "0.28", default-features = false }
|
||||
shadow-rs = { version = "0.29", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
shadow-rs = { version = "0.28", default-features = false }
|
||||
shadow-rs = { version = "0.29", default-features = false }
|
||||
|
||||
[features]
|
||||
mimalloc = []
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::engine::CommandType;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Break;
|
||||
|
@ -18,6 +19,15 @@ impl Command for Break {
|
|||
.category(Category::Core)
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
r#"This command is a parser keyword. For details, check:
|
||||
https://www.nushell.sh/book/thinking_in_nu.html"#
|
||||
}
|
||||
|
||||
fn command_type(&self) -> CommandType {
|
||||
CommandType::Keyword
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
_engine_state: &EngineState,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::engine::CommandType;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Continue;
|
||||
|
@ -18,6 +19,14 @@ impl Command for Continue {
|
|||
.category(Category::Core)
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
r#"This command is a parser keyword. For details, check:
|
||||
https://www.nushell.sh/book/thinking_in_nu.html"#
|
||||
}
|
||||
|
||||
fn command_type(&self) -> CommandType {
|
||||
CommandType::Keyword
|
||||
}
|
||||
fn run(
|
||||
&self,
|
||||
_engine_state: &EngineState,
|
||||
|
|
|
@ -2,7 +2,7 @@ use nu_engine::{
|
|||
command_prelude::*, get_eval_block, get_eval_expression, get_eval_expression_with_input,
|
||||
};
|
||||
use nu_protocol::{
|
||||
engine::StateWorkingSet,
|
||||
engine::{CommandType, StateWorkingSet},
|
||||
eval_const::{eval_const_subexpression, eval_constant, eval_constant_with_input},
|
||||
};
|
||||
|
||||
|
@ -41,6 +41,15 @@ impl Command for If {
|
|||
.category(Category::Core)
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
r#"This command is a parser keyword. For details, check:
|
||||
https://www.nushell.sh/book/thinking_in_nu.html"#
|
||||
}
|
||||
|
||||
fn command_type(&self) -> CommandType {
|
||||
CommandType::Keyword
|
||||
}
|
||||
|
||||
fn is_const(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use nu_engine::{command_prelude::*, get_eval_block};
|
||||
use nu_protocol::engine::CommandType;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Loop;
|
||||
|
@ -20,6 +21,15 @@ impl Command for Loop {
|
|||
.category(Category::Core)
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
r#"This command is a parser keyword. For details, check:
|
||||
https://www.nushell.sh/book/thinking_in_nu.html"#
|
||||
}
|
||||
|
||||
fn command_type(&self) -> CommandType {
|
||||
CommandType::Keyword
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use nu_engine::{
|
||||
command_prelude::*, get_eval_block, get_eval_expression, get_eval_expression_with_input,
|
||||
};
|
||||
use nu_protocol::engine::Matcher;
|
||||
use nu_protocol::engine::{CommandType, Matcher};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Match;
|
||||
|
@ -27,6 +27,15 @@ impl Command for Match {
|
|||
.category(Category::Core)
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
r#"This command is a parser keyword. For details, check:
|
||||
https://www.nushell.sh/book/thinking_in_nu.html"#
|
||||
}
|
||||
|
||||
fn command_type(&self) -> CommandType {
|
||||
CommandType::Keyword
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use nu_engine::{command_prelude::*, get_full_help};
|
||||
use nu_protocol::engine::CommandType;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Scope;
|
||||
|
@ -20,10 +19,6 @@ impl Command for Scope {
|
|||
"Commands for getting info about what is in scope."
|
||||
}
|
||||
|
||||
fn command_type(&self) -> CommandType {
|
||||
CommandType::Keyword
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use nu_engine::{command_prelude::*, get_eval_block, EvalBlockFn};
|
||||
use nu_protocol::engine::Closure;
|
||||
use nu_protocol::engine::{Closure, CommandType};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Try;
|
||||
|
@ -31,6 +31,15 @@ impl Command for Try {
|
|||
.category(Category::Core)
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
r#"This command is a parser keyword. For details, check:
|
||||
https://www.nushell.sh/book/thinking_in_nu.html"#
|
||||
}
|
||||
|
||||
fn command_type(&self) -> CommandType {
|
||||
CommandType::Keyword
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use nu_engine::{command_prelude::*, get_eval_block, get_eval_expression};
|
||||
use nu_protocol::engine::CommandType;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct While;
|
||||
|
@ -29,6 +30,15 @@ impl Command for While {
|
|||
vec!["loop"]
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
r#"This command is a parser keyword. For details, check:
|
||||
https://www.nushell.sh/book/thinking_in_nu.html"#
|
||||
}
|
||||
|
||||
fn command_type(&self) -> CommandType {
|
||||
CommandType::Keyword
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
|
|
@ -5,15 +5,15 @@ edition = "2021"
|
|||
license = "MIT"
|
||||
name = "nu-cmd-plugin"
|
||||
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-cmd-plugin"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0", features = ["plugin"] }
|
||||
nu-plugin-engine = { path = "../nu-plugin-engine", version = "0.95.0" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1", features = ["plugin"] }
|
||||
nu-plugin-engine = { path = "../nu-plugin-engine", version = "0.95.1" }
|
||||
|
||||
itertools = { workspace = true }
|
||||
|
||||
|
|
|
@ -5,18 +5,18 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-color-confi
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-color-config"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0" }
|
||||
nu-json = { path = "../nu-json", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1" }
|
||||
nu-json = { path = "../nu-json", version = "0.95.1" }
|
||||
nu-ansi-term = { workspace = true }
|
||||
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
|
||||
[dev-dependencies]
|
||||
nu-test-support = { path = "../nu-test-support", version = "0.95.0" }
|
||||
nu-test-support = { path = "../nu-test-support", version = "0.95.1" }
|
|
@ -5,7 +5,7 @@ edition = "2021"
|
|||
license = "MIT"
|
||||
name = "nu-command"
|
||||
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-command"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
@ -13,21 +13,21 @@ version = "0.95.0"
|
|||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-cmd-base = { path = "../nu-cmd-base", version = "0.95.0" }
|
||||
nu-color-config = { path = "../nu-color-config", version = "0.95.0" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0" }
|
||||
nu-glob = { path = "../nu-glob", version = "0.95.0" }
|
||||
nu-json = { path = "../nu-json", version = "0.95.0" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.0" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.0" }
|
||||
nu-pretty-hex = { path = "../nu-pretty-hex", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-system = { path = "../nu-system", version = "0.95.0" }
|
||||
nu-table = { path = "../nu-table", version = "0.95.0" }
|
||||
nu-term-grid = { path = "../nu-term-grid", version = "0.95.0" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.0" }
|
||||
nu-cmd-base = { path = "../nu-cmd-base", version = "0.95.1" }
|
||||
nu-color-config = { path = "../nu-color-config", version = "0.95.1" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1" }
|
||||
nu-glob = { path = "../nu-glob", version = "0.95.1" }
|
||||
nu-json = { path = "../nu-json", version = "0.95.1" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.1" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.1" }
|
||||
nu-pretty-hex = { path = "../nu-pretty-hex", version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
nu-system = { path = "../nu-system", version = "0.95.1" }
|
||||
nu-table = { path = "../nu-table", version = "0.95.1" }
|
||||
nu-term-grid = { path = "../nu-term-grid", version = "0.95.1" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.1" }
|
||||
nu-ansi-term = { workspace = true }
|
||||
nuon = { path = "../nuon", version = "0.95.0" }
|
||||
nuon = { path = "../nuon", version = "0.95.1" }
|
||||
|
||||
alphanumeric-sort = { workspace = true }
|
||||
base64 = { workspace = true }
|
||||
|
@ -136,8 +136,8 @@ sqlite = ["rusqlite"]
|
|||
trash-support = ["trash"]
|
||||
|
||||
[dev-dependencies]
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.95.0" }
|
||||
nu-test-support = { path = "../nu-test-support", version = "0.95.0" }
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.95.1" }
|
||||
nu-test-support = { path = "../nu-test-support", version = "0.95.1" }
|
||||
|
||||
dirs-next = { workspace = true }
|
||||
mockito = { workspace = true, default-features = false }
|
||||
|
|
10
crates/nu-command/src/env/export_env.rs
vendored
10
crates/nu-command/src/env/export_env.rs
vendored
|
@ -1,4 +1,5 @@
|
|||
use nu_engine::{command_prelude::*, get_eval_block, redirect_env};
|
||||
use nu_protocol::engine::CommandType;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ExportEnv;
|
||||
|
@ -23,6 +24,15 @@ impl Command for ExportEnv {
|
|||
"Run a block and preserve its environment in a current scope."
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
r#"This command is a parser keyword. For details, check:
|
||||
https://www.nushell.sh/book/thinking_in_nu.html"#
|
||||
}
|
||||
|
||||
fn command_type(&self) -> CommandType {
|
||||
CommandType::Keyword
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
|
10
crates/nu-command/src/env/source_env.rs
vendored
10
crates/nu-command/src/env/source_env.rs
vendored
|
@ -2,6 +2,7 @@ use nu_engine::{
|
|||
command_prelude::*, find_in_dirs_env, get_dirs_var_from_call, get_eval_block_with_early_return,
|
||||
redirect_env,
|
||||
};
|
||||
use nu_protocol::engine::CommandType;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Source a file for environment variables.
|
||||
|
@ -28,6 +29,15 @@ impl Command for SourceEnv {
|
|||
"Source the environment from a source file into the current environment."
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
r#"This command is a parser keyword. For details, check:
|
||||
https://www.nushell.sh/book/thinking_in_nu.html"#
|
||||
}
|
||||
|
||||
fn command_type(&self) -> CommandType {
|
||||
CommandType::Keyword
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
|
|
@ -175,20 +175,32 @@ impl Command for Ls {
|
|||
},
|
||||
Example {
|
||||
description: "List files and directories whose name do not contain 'bar'",
|
||||
example: "ls -s | where name !~ bar",
|
||||
example: "ls | where name !~ bar",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "List all dirs in your home directory",
|
||||
description: "List the full path of all dirs in your home directory",
|
||||
example: "ls -a ~ | where type == dir",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description:
|
||||
"List all dirs in your home directory which have not been modified in 7 days",
|
||||
"List only the names (not paths) of all dirs in your home directory which have not been modified in 7 days",
|
||||
example: "ls -as ~ | where type == dir and modified < ((date now) - 7day)",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description:
|
||||
"Recursively list all files and subdirectories under the current directory using a glob pattern",
|
||||
example: "ls -a **/*",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description:
|
||||
"Recursively list *.rs and *.toml files using the glob command",
|
||||
example: "ls ...(glob **/*.{rs,toml})",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "List given paths and show directories themselves",
|
||||
example: "['/path/to/directory' '/path/to/file'] | each {|| ls -D $in } | flatten",
|
||||
|
|
|
@ -69,9 +69,9 @@ impl Command for Find {
|
|||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Search and highlight text for a term in a string",
|
||||
example: r#"'Cargo.toml' | find toml"#,
|
||||
result: Some(Value::test_string("\u{1b}[37mCargo.\u{1b}[0m\u{1b}[41;37mtoml\u{1b}[0m\u{1b}[37m\u{1b}[0m".to_owned())),
|
||||
description: "Search and highlight text for a term in a string. Note that regular search is case insensitive",
|
||||
example: r#"'Cargo.toml' | find cargo"#,
|
||||
result: Some(Value::test_string("\u{1b}[37m\u{1b}[0m\u{1b}[41;37mCargo\u{1b}[0m\u{1b}[37m.toml\u{1b}[0m".to_owned())),
|
||||
},
|
||||
Example {
|
||||
description: "Search a number or a file size in a list of numbers",
|
||||
|
@ -457,9 +457,10 @@ fn find_with_rest_and_highlight(
|
|||
|
||||
let mut output: Vec<Value> = vec![];
|
||||
for line in lines {
|
||||
let line = line?.to_lowercase();
|
||||
let line = line?;
|
||||
let lower_val = line.to_lowercase();
|
||||
for term in &terms {
|
||||
if line.contains(term) {
|
||||
if lower_val.contains(term) {
|
||||
output.push(Value::string(
|
||||
highlight_search_string(
|
||||
&line,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use nu_engine::{command_prelude::*, ClosureEval};
|
||||
use nu_protocol::engine::Closure;
|
||||
use nu_protocol::engine::{Closure, CommandType};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Where;
|
||||
|
@ -19,6 +19,10 @@ tables, known as "row conditions". On the other hand, reading the condition from
|
|||
not supported."#
|
||||
}
|
||||
|
||||
fn command_type(&self) -> CommandType {
|
||||
CommandType::Keyword
|
||||
}
|
||||
|
||||
fn signature(&self) -> nu_protocol::Signature {
|
||||
Signature::build("where")
|
||||
.input_output_types(vec![
|
||||
|
|
|
@ -39,7 +39,7 @@ fn from_delimited_stream(
|
|||
.from_reader(input_reader);
|
||||
|
||||
let headers = if noheaders {
|
||||
(1..=reader
|
||||
(0..reader
|
||||
.headers()
|
||||
.map_err(|err| from_csv_error(err, span))?
|
||||
.len())
|
||||
|
|
|
@ -52,12 +52,12 @@ impl Command for FromSsv {
|
|||
Value::test_list(
|
||||
vec![
|
||||
Value::test_record(record! {
|
||||
"column1" => Value::test_string("FOO"),
|
||||
"column2" => Value::test_string("BAR"),
|
||||
"column0" => Value::test_string("FOO"),
|
||||
"column1" => Value::test_string("BAR"),
|
||||
}),
|
||||
Value::test_record(record! {
|
||||
"column1" => Value::test_string("1"),
|
||||
"column2" => Value::test_string("2"),
|
||||
"column0" => Value::test_string("1"),
|
||||
"column1" => Value::test_string("2"),
|
||||
}),
|
||||
],
|
||||
)
|
||||
|
@ -170,7 +170,7 @@ fn parse_aligned_columns<'a>(
|
|||
let headers: Vec<(String, usize)> = indices
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, position)| (format!("column{}", i + 1), *position))
|
||||
.map(|(i, position)| (format!("column{}", i), *position))
|
||||
.collect();
|
||||
|
||||
construct(ls.iter().map(|s| s.to_owned()), headers)
|
||||
|
@ -215,7 +215,7 @@ fn parse_separated_columns<'a>(
|
|||
let parse_without_headers = |ls: Vec<&str>| {
|
||||
let num_columns = ls.iter().map(|r| r.len()).max().unwrap_or(0);
|
||||
|
||||
let headers = (1..=num_columns)
|
||||
let headers = (0..=num_columns)
|
||||
.map(|i| format!("column{i}"))
|
||||
.collect::<Vec<String>>();
|
||||
collect(headers, ls.into_iter(), separator)
|
||||
|
@ -370,9 +370,9 @@ mod tests {
|
|||
assert_eq!(
|
||||
result,
|
||||
vec![
|
||||
vec![owned("column1", "a"), owned("column2", "b")],
|
||||
vec![owned("column1", "1"), owned("column2", "2")],
|
||||
vec![owned("column1", "3"), owned("column2", "4")]
|
||||
vec![owned("column0", "a"), owned("column1", "b")],
|
||||
vec![owned("column0", "1"), owned("column1", "2")],
|
||||
vec![owned("column0", "3"), owned("column1", "4")]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -484,25 +484,25 @@ mod tests {
|
|||
result,
|
||||
vec![
|
||||
vec![
|
||||
owned("column1", "a multi-word value"),
|
||||
owned("column2", "b"),
|
||||
owned("column3", ""),
|
||||
owned("column4", "d"),
|
||||
owned("column5", "")
|
||||
],
|
||||
vec![
|
||||
owned("column1", "1"),
|
||||
owned("column0", "a multi-word value"),
|
||||
owned("column1", "b"),
|
||||
owned("column2", ""),
|
||||
owned("column3", "3-3"),
|
||||
owned("column4", "4"),
|
||||
owned("column5", "")
|
||||
owned("column3", "d"),
|
||||
owned("column4", "")
|
||||
],
|
||||
vec![
|
||||
owned("column0", "1"),
|
||||
owned("column1", ""),
|
||||
owned("column2", "3-3"),
|
||||
owned("column3", "4"),
|
||||
owned("column4", "")
|
||||
],
|
||||
vec![
|
||||
owned("column0", ""),
|
||||
owned("column1", ""),
|
||||
owned("column2", ""),
|
||||
owned("column3", ""),
|
||||
owned("column4", ""),
|
||||
owned("column5", "last")
|
||||
owned("column4", "last")
|
||||
],
|
||||
]
|
||||
);
|
||||
|
|
|
@ -19,6 +19,9 @@ static CHAR_MAP: Lazy<IndexMap<&'static str, String>> = Lazy::new(|| {
|
|||
// These are some regular characters that either can't be used or
|
||||
// it's just easier to use them like this.
|
||||
|
||||
"nul" => '\x00'.to_string(), // nul character, 0x00
|
||||
"null_byte" => '\x00'.to_string(), // nul character, 0x00
|
||||
"zero_byte" => '\x00'.to_string(), // nul character, 0x00
|
||||
// This are the "normal" characters section
|
||||
"newline" => '\n'.to_string(),
|
||||
"enter" => '\n'.to_string(),
|
||||
|
|
|
@ -17,6 +17,16 @@ fn find_with_list_search_with_char() {
|
|||
assert_eq!(actual.out, "[\"\\u001b[37m\\u001b[0m\\u001b[41;37ml\\u001b[0m\\u001b[37marry\\u001b[0m\",\"\\u001b[37mcur\\u001b[0m\\u001b[41;37ml\\u001b[0m\\u001b[37my\\u001b[0m\"]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn find_with_bytestream_search_with_char() {
|
||||
let actual =
|
||||
nu!("\"ABC\" | save foo.txt; let res = open foo.txt | find abc; rm foo.txt; $res | get 0");
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
"\u{1b}[37m\u{1b}[0m\u{1b}[41;37mABC\u{1b}[0m\u{1b}[37m\u{1b}[0m"
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn find_with_list_search_with_number() {
|
||||
let actual = nu!("[1 2 3 4 5] | find 3 | get 0");
|
||||
|
|
|
@ -284,7 +284,7 @@ fn from_csv_text_skipping_headers_to_table() {
|
|||
r#"
|
||||
open los_tres_amigos.txt
|
||||
| from csv --noheaders
|
||||
| get column3
|
||||
| get column2
|
||||
| length
|
||||
"#
|
||||
));
|
||||
|
|
|
@ -74,7 +74,7 @@ fn from_ssv_text_treating_first_line_as_data_with_flag() {
|
|||
open oc_get_svc.txt
|
||||
| from ssv --noheaders -a
|
||||
| first
|
||||
| get column1
|
||||
| get column0
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -84,7 +84,7 @@ fn from_ssv_text_treating_first_line_as_data_with_flag() {
|
|||
open oc_get_svc.txt
|
||||
| from ssv --noheaders
|
||||
| first
|
||||
| get column1
|
||||
| get column0
|
||||
|
||||
"#
|
||||
));
|
||||
|
|
|
@ -207,7 +207,7 @@ fn from_tsv_text_skipping_headers_to_table() {
|
|||
r#"
|
||||
open los_tres_amigos.txt
|
||||
| from tsv --noheaders
|
||||
| get column3
|
||||
| get column2
|
||||
| length
|
||||
"#
|
||||
));
|
||||
|
|
|
@ -5,7 +5,7 @@ edition = "2021"
|
|||
license = "MIT"
|
||||
name = "nu-derive-value"
|
||||
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-derive-value"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
|
|
@ -5,16 +5,16 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-engine"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-engine"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-protocol = { path = "../nu-protocol", features = ["plugin"], version = "0.95.0" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.0" }
|
||||
nu-glob = { path = "../nu-glob", version = "0.95.0" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", features = ["plugin"], version = "0.95.1" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.1" }
|
||||
nu-glob = { path = "../nu-glob", version = "0.95.1" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.1" }
|
||||
|
||||
[features]
|
||||
plugin = []
|
|
@ -5,21 +5,21 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-explore"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-explore"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.0" }
|
||||
nu-color-config = { path = "../nu-color-config", version = "0.95.0" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0" }
|
||||
nu-table = { path = "../nu-table", version = "0.95.0" }
|
||||
nu-json = { path = "../nu-json", version = "0.95.0" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.1" }
|
||||
nu-color-config = { path = "../nu-color-config", version = "0.95.1" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1" }
|
||||
nu-table = { path = "../nu-table", version = "0.95.1" }
|
||||
nu-json = { path = "../nu-json", version = "0.95.1" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.1" }
|
||||
nu-ansi-term = { workspace = true }
|
||||
nu-pretty-hex = { path = "../nu-pretty-hex", version = "0.95.0" }
|
||||
nu-pretty-hex = { path = "../nu-pretty-hex", version = "0.95.1" }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
log = { workspace = true }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "nu-glob"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
authors = ["The Nushell Project Developers", "The Rust Project Developers"]
|
||||
license = "MIT/Apache-2.0"
|
||||
description = """
|
||||
|
|
|
@ -5,7 +5,7 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-json"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-json"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
@ -23,5 +23,5 @@ serde = { workspace = true }
|
|||
serde_json = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
# nu-path = { path="../nu-path", version = "0.95.0" }
|
||||
# nu-path = { path="../nu-path", version = "0.95.1" }
|
||||
# serde_json = "1.0"
|
|
@ -3,14 +3,14 @@ authors = ["The Nushell Project Developers"]
|
|||
description = "Nushell's integrated LSP server"
|
||||
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-lsp"
|
||||
name = "nu-lsp"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
|
||||
[dependencies]
|
||||
nu-cli = { path = "../nu-cli", version = "0.95.0" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-cli = { path = "../nu-cli", version = "0.95.1" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
|
||||
reedline = { workspace = true }
|
||||
|
||||
|
@ -23,8 +23,8 @@ serde = { workspace = true }
|
|||
serde_json = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.95.0" }
|
||||
nu-command = { path = "../nu-command", version = "0.95.0" }
|
||||
nu-test-support = { path = "../nu-test-support", version = "0.95.0" }
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.95.1" }
|
||||
nu-command = { path = "../nu-command", version = "0.95.1" }
|
||||
nu-test-support = { path = "../nu-test-support", version = "0.95.1" }
|
||||
|
||||
assert-json-diff = "2.0"
|
|
@ -5,17 +5,17 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-parser"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-parser"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
exclude = ["/fuzz"]
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.0" }
|
||||
nu-plugin-engine = { path = "../nu-plugin-engine", optional = true, version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.1" }
|
||||
nu-plugin-engine = { path = "../nu-plugin-engine", optional = true, version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
|
||||
bytesize = { workspace = true }
|
||||
chrono = { default-features = false, features = ['std'], workspace = true }
|
||||
|
|
|
@ -8,7 +8,6 @@ mod parse_keywords;
|
|||
mod parse_patterns;
|
||||
mod parse_shape_specs;
|
||||
mod parser;
|
||||
mod parser_path;
|
||||
mod type_check;
|
||||
|
||||
pub use deparse::{escape_for_script_arg, escape_quote_string};
|
||||
|
@ -18,8 +17,8 @@ pub use flatten::{
|
|||
pub use known_external::KnownExternal;
|
||||
pub use lex::{lex, lex_signature, Token, TokenContents};
|
||||
pub use lite_parser::{lite_parse, LiteBlock, LiteCommand};
|
||||
pub use nu_protocol::parser_path::*;
|
||||
pub use parse_keywords::*;
|
||||
pub use parser_path::*;
|
||||
|
||||
pub use parser::{
|
||||
is_math_expression_like, parse, parse_block, parse_expression, parse_external_call,
|
||||
|
|
|
@ -2,7 +2,6 @@ use crate::{
|
|||
exportable::Exportable,
|
||||
parse_block,
|
||||
parser::{parse_redirection, redirecting_builtin_error},
|
||||
parser_path::ParserPath,
|
||||
type_check::{check_block_input_output, type_compatible},
|
||||
};
|
||||
use itertools::Itertools;
|
||||
|
@ -15,6 +14,7 @@ use nu_protocol::{
|
|||
},
|
||||
engine::{StateWorkingSet, DEFAULT_OVERLAY_NAME},
|
||||
eval_const::eval_constant,
|
||||
parser_path::ParserPath,
|
||||
Alias, BlockId, DeclId, Module, ModuleId, ParseError, PositionalArg, ResolvedImportPattern,
|
||||
Span, Spanned, SyntaxShape, Type, Value, VarId,
|
||||
};
|
||||
|
@ -42,32 +42,44 @@ use crate::{
|
|||
};
|
||||
|
||||
/// These parser keywords can be aliased
|
||||
pub const ALIASABLE_PARSER_KEYWORDS: &[&[u8]] = &[b"overlay hide", b"overlay new", b"overlay use"];
|
||||
pub const ALIASABLE_PARSER_KEYWORDS: &[&[u8]] = &[
|
||||
b"if",
|
||||
b"match",
|
||||
b"try",
|
||||
b"overlay",
|
||||
b"overlay hide",
|
||||
b"overlay new",
|
||||
b"overlay use",
|
||||
];
|
||||
|
||||
pub const RESERVED_VARIABLE_NAMES: [&str; 3] = ["in", "nu", "env"];
|
||||
|
||||
/// These parser keywords cannot be aliased (either not possible, or support not yet added)
|
||||
pub const UNALIASABLE_PARSER_KEYWORDS: &[&[u8]] = &[
|
||||
b"export",
|
||||
b"def",
|
||||
b"export def",
|
||||
b"for",
|
||||
b"extern",
|
||||
b"export extern",
|
||||
b"alias",
|
||||
b"export alias",
|
||||
b"export-env",
|
||||
b"const",
|
||||
b"def",
|
||||
b"extern",
|
||||
b"module",
|
||||
b"use",
|
||||
b"export",
|
||||
b"export alias",
|
||||
b"export const",
|
||||
b"export def",
|
||||
b"export extern",
|
||||
b"export module",
|
||||
b"export use",
|
||||
b"hide",
|
||||
// b"overlay",
|
||||
// b"overlay hide",
|
||||
// b"overlay new",
|
||||
// b"overlay use",
|
||||
b"for",
|
||||
b"loop",
|
||||
b"while",
|
||||
b"return",
|
||||
b"break",
|
||||
b"continue",
|
||||
b"let",
|
||||
b"const",
|
||||
b"mut",
|
||||
b"hide",
|
||||
b"export-env",
|
||||
b"source-env",
|
||||
b"source",
|
||||
b"where",
|
||||
b"register",
|
||||
|
@ -1192,7 +1204,7 @@ pub fn parse_export_in_block(
|
|||
"export alias" => parse_alias(working_set, lite_command, None),
|
||||
"export def" => parse_def(working_set, lite_command, None).0,
|
||||
"export const" => parse_const(working_set, &lite_command.parts[1..]),
|
||||
"export use" => parse_use(working_set, lite_command).0,
|
||||
"export use" => parse_use(working_set, lite_command, None).0,
|
||||
"export module" => parse_module(working_set, lite_command, None).0,
|
||||
"export extern" => parse_extern(working_set, lite_command, None),
|
||||
_ => {
|
||||
|
@ -1211,6 +1223,7 @@ pub fn parse_export_in_module(
|
|||
working_set: &mut StateWorkingSet,
|
||||
lite_command: &LiteCommand,
|
||||
module_name: &[u8],
|
||||
parent_module: &mut Module,
|
||||
) -> (Pipeline, Vec<Exportable>) {
|
||||
let spans = &lite_command.parts[..];
|
||||
|
||||
|
@ -1416,7 +1429,8 @@ pub fn parse_export_in_module(
|
|||
pipe: lite_command.pipe,
|
||||
redirection: lite_command.redirection.clone(),
|
||||
};
|
||||
let (pipeline, exportables) = parse_use(working_set, &lite_command);
|
||||
let (pipeline, exportables) =
|
||||
parse_use(working_set, &lite_command, Some(parent_module));
|
||||
|
||||
let export_use_decl_id = if let Some(id) = working_set.find_decl(b"export use") {
|
||||
id
|
||||
|
@ -1759,7 +1773,7 @@ pub fn parse_module_block(
|
|||
))
|
||||
}
|
||||
b"use" => {
|
||||
let (pipeline, _) = parse_use(working_set, command);
|
||||
let (pipeline, _) = parse_use(working_set, command, Some(&mut module));
|
||||
|
||||
block.pipelines.push(pipeline)
|
||||
}
|
||||
|
@ -1774,7 +1788,7 @@ pub fn parse_module_block(
|
|||
}
|
||||
b"export" => {
|
||||
let (pipe, exportables) =
|
||||
parse_export_in_module(working_set, command, module_name);
|
||||
parse_export_in_module(working_set, command, module_name, &mut module);
|
||||
|
||||
for exportable in exportables {
|
||||
match exportable {
|
||||
|
@ -1884,6 +1898,48 @@ pub fn parse_module_block(
|
|||
(block, module, module_comments)
|
||||
}
|
||||
|
||||
fn module_needs_reloading(working_set: &StateWorkingSet, module_id: ModuleId) -> bool {
|
||||
let module = working_set.get_module(module_id);
|
||||
|
||||
fn submodule_need_reloading(working_set: &StateWorkingSet, submodule_id: ModuleId) -> bool {
|
||||
let submodule = working_set.get_module(submodule_id);
|
||||
let submodule_changed = if let Some((file_path, file_id)) = &submodule.file {
|
||||
let existing_contents = working_set.get_contents_of_file(*file_id);
|
||||
let file_contents = file_path.read(working_set);
|
||||
|
||||
if let (Some(existing), Some(new)) = (existing_contents, file_contents) {
|
||||
existing != new
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
if submodule_changed {
|
||||
true
|
||||
} else {
|
||||
module_needs_reloading(working_set, submodule_id)
|
||||
}
|
||||
}
|
||||
|
||||
let export_submodule_changed = module
|
||||
.submodules
|
||||
.iter()
|
||||
.any(|(_, submodule_id)| submodule_need_reloading(working_set, *submodule_id));
|
||||
|
||||
if export_submodule_changed {
|
||||
return true;
|
||||
}
|
||||
|
||||
let private_submodule_changed = module
|
||||
.imported_modules
|
||||
.iter()
|
||||
.any(|submodule_id| submodule_need_reloading(working_set, *submodule_id));
|
||||
|
||||
private_submodule_changed
|
||||
}
|
||||
|
||||
/// Parse a module from a file.
|
||||
///
|
||||
/// The module name is inferred from the stem of the file, unless specified in `name_override`.
|
||||
|
@ -1922,23 +1978,26 @@ fn parse_module_file(
|
|||
|
||||
// Check if we've parsed the module before.
|
||||
if let Some(module_id) = working_set.find_module_by_span(new_span) {
|
||||
return Some(module_id);
|
||||
if !module_needs_reloading(working_set, module_id) {
|
||||
return Some(module_id);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the file to the stack of files being processed.
|
||||
if let Err(e) = working_set.files.push(path.path_buf(), path_span) {
|
||||
if let Err(e) = working_set.files.push(path.clone().path_buf(), path_span) {
|
||||
working_set.error(e);
|
||||
return None;
|
||||
}
|
||||
|
||||
// Parse the module
|
||||
let (block, module, module_comments) =
|
||||
let (block, mut module, module_comments) =
|
||||
parse_module_block(working_set, new_span, module_name.as_bytes());
|
||||
|
||||
// Remove the file from the stack of files being processed.
|
||||
working_set.files.pop();
|
||||
|
||||
let _ = working_set.add_block(Arc::new(block));
|
||||
module.file = Some((path, file_id));
|
||||
let module_id = working_set.add_module(&module_name, module, module_comments);
|
||||
|
||||
Some(module_id)
|
||||
|
@ -2228,6 +2287,7 @@ pub fn parse_module(
|
|||
pub fn parse_use(
|
||||
working_set: &mut StateWorkingSet,
|
||||
lite_command: &LiteCommand,
|
||||
parent_module: Option<&mut Module>,
|
||||
) -> (Pipeline, Vec<Exportable>) {
|
||||
let spans = &lite_command.parts;
|
||||
|
||||
|
@ -2373,12 +2433,14 @@ pub fn parse_use(
|
|||
);
|
||||
};
|
||||
|
||||
let mut imported_modules = vec![];
|
||||
let (definitions, errors) = module.resolve_import_pattern(
|
||||
working_set,
|
||||
module_id,
|
||||
&import_pattern.members,
|
||||
None,
|
||||
name_span,
|
||||
&mut imported_modules,
|
||||
);
|
||||
|
||||
working_set.parse_errors.extend(errors);
|
||||
|
@ -2420,6 +2482,9 @@ pub fn parse_use(
|
|||
|
||||
import_pattern.constants = constants.iter().map(|(_, id)| *id).collect();
|
||||
|
||||
if let Some(m) = parent_module {
|
||||
m.track_imported_modules(&imported_modules)
|
||||
}
|
||||
// Extend the current scope with the module's exportables
|
||||
working_set.use_decls(definitions.decls);
|
||||
working_set.use_modules(definitions.modules);
|
||||
|
@ -2853,6 +2918,7 @@ pub fn parse_overlay_use(working_set: &mut StateWorkingSet, call: Box<Call>) ->
|
|||
&[],
|
||||
Some(final_overlay_name.as_bytes()),
|
||||
call.head,
|
||||
&mut vec![],
|
||||
)
|
||||
} else {
|
||||
origin_module.resolve_import_pattern(
|
||||
|
@ -2863,6 +2929,7 @@ pub fn parse_overlay_use(working_set: &mut StateWorkingSet, call: Box<Call>) ->
|
|||
}],
|
||||
Some(final_overlay_name.as_bytes()),
|
||||
call.head,
|
||||
&mut vec![],
|
||||
)
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -934,15 +934,12 @@ pub fn parse_internal_call(
|
|||
let output = signature.get_output_type();
|
||||
|
||||
// storing the var ID for later due to borrowing issues
|
||||
let lib_dirs_var_id = if decl.is_builtin() {
|
||||
match decl.name() {
|
||||
"use" | "overlay use" | "source-env" | "nu-check" => {
|
||||
find_dirs_var(working_set, LIB_DIRS_VAR)
|
||||
}
|
||||
_ => None,
|
||||
let lib_dirs_var_id = match decl.name() {
|
||||
"use" | "overlay use" | "source-env" if decl.is_keyword() => {
|
||||
find_dirs_var(working_set, LIB_DIRS_VAR)
|
||||
}
|
||||
} else {
|
||||
None
|
||||
"nu-check" if decl.is_builtin() => find_dirs_var(working_set, LIB_DIRS_VAR),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
// The index into the positional parameter in the definition
|
||||
|
@ -5380,7 +5377,7 @@ pub fn parse_builtin_commands(
|
|||
}
|
||||
b"alias" => parse_alias(working_set, lite_command, None),
|
||||
b"module" => parse_module(working_set, lite_command, None).0,
|
||||
b"use" => parse_use(working_set, lite_command).0,
|
||||
b"use" => parse_use(working_set, lite_command, None).0,
|
||||
b"overlay" => {
|
||||
if let Some(redirection) = lite_command.redirection.as_ref() {
|
||||
working_set.error(redirecting_builtin_error("overlay", redirection));
|
||||
|
|
|
@ -5,7 +5,7 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-path"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-path"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
exclude = ["/fuzz"]
|
||||
|
||||
[lib]
|
||||
|
|
161
crates/nu-path/src/form.rs
Normal file
161
crates/nu-path/src/form.rs
Normal file
|
@ -0,0 +1,161 @@
|
|||
use std::ffi::OsStr;
|
||||
|
||||
mod private {
|
||||
use std::ffi::OsStr;
|
||||
|
||||
// This trait should not be extended by external crates in order to uphold safety guarantees.
|
||||
// As such, this trait is put inside a private module to prevent external impls.
|
||||
// This ensures that all possible [`PathForm`]s can only be defined here and will:
|
||||
// - be zero sized (enforced anyways by the `repr(transparent)` on `Path`)
|
||||
// - have a no-op [`Drop`] implementation
|
||||
pub trait Sealed: 'static {
|
||||
fn invariants_satisfied<P: AsRef<OsStr> + ?Sized>(path: &P) -> bool;
|
||||
}
|
||||
}
|
||||
|
||||
/// A marker trait for the different kinds of path forms.
|
||||
/// Each form has its own invariants that are guaranteed be upheld.
|
||||
/// The list of path forms are:
|
||||
/// - [`Any`]: a path with no invariants. It may be a relative or an absolute path.
|
||||
/// - [`Relative`]: a strictly relative path.
|
||||
/// - [`Absolute`]: a strictly absolute path.
|
||||
/// - [`Canonical`]: a path that must be in canonicalized form.
|
||||
pub trait PathForm: private::Sealed {}
|
||||
impl PathForm for Any {}
|
||||
impl PathForm for Relative {}
|
||||
impl PathForm for Absolute {}
|
||||
impl PathForm for Canonical {}
|
||||
|
||||
/// A path whose form is unknown. It could be a relative, absolute, or canonical path.
|
||||
///
|
||||
/// The path is not guaranteed to be normalized. It may contain unresolved symlinks,
|
||||
/// trailing slashes, dot components (`..` or `.`), and repeated path separators.
|
||||
pub struct Any;
|
||||
|
||||
impl private::Sealed for Any {
|
||||
fn invariants_satisfied<P: AsRef<OsStr> + ?Sized>(_: &P) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
/// A strictly relative path.
|
||||
///
|
||||
/// The path is not guaranteed to be normalized. It may contain unresolved symlinks,
|
||||
/// trailing slashes, dot components (`..` or `.`), and repeated path separators.
|
||||
pub struct Relative;
|
||||
|
||||
impl private::Sealed for Relative {
|
||||
fn invariants_satisfied<P: AsRef<OsStr> + ?Sized>(path: &P) -> bool {
|
||||
std::path::Path::new(path).is_relative()
|
||||
}
|
||||
}
|
||||
|
||||
/// An absolute path.
|
||||
///
|
||||
/// The path is not guaranteed to be normalized. It may contain unresolved symlinks,
|
||||
/// trailing slashes, dot components (`..` or `.`), and repeated path separators.
|
||||
pub struct Absolute;
|
||||
|
||||
impl private::Sealed for Absolute {
|
||||
fn invariants_satisfied<P: AsRef<OsStr> + ?Sized>(path: &P) -> bool {
|
||||
std::path::Path::new(path).is_absolute()
|
||||
}
|
||||
}
|
||||
|
||||
// A canonical path.
|
||||
//
|
||||
// An absolute path with all intermediate components normalized and symbolic links resolved.
|
||||
pub struct Canonical;
|
||||
|
||||
impl private::Sealed for Canonical {
|
||||
fn invariants_satisfied<P: AsRef<OsStr> + ?Sized>(_: &P) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
/// A marker trait for [`PathForm`]s that may be relative paths.
|
||||
/// This includes only the [`Any`] and [`Relative`] path forms.
|
||||
///
|
||||
/// [`push`](crate::PathBuf::push) and [`join`](crate::Path::join)
|
||||
/// operations only support [`MaybeRelative`] path forms as input.
|
||||
pub trait MaybeRelative: PathForm {}
|
||||
impl MaybeRelative for Any {}
|
||||
impl MaybeRelative for Relative {}
|
||||
|
||||
/// A marker trait for [`PathForm`]s that may be absolute paths.
|
||||
/// This includes the [`Any`], [`Absolute`], and [`Canonical`] path forms.
|
||||
pub trait MaybeAbsolute: PathForm {}
|
||||
impl MaybeAbsolute for Any {}
|
||||
impl MaybeAbsolute for Absolute {}
|
||||
impl MaybeAbsolute for Canonical {}
|
||||
|
||||
/// A marker trait for [`PathForm`]s that are absolute paths.
|
||||
/// This includes only the [`Absolute`] and [`Canonical`] path forms.
|
||||
///
|
||||
/// Only [`PathForm`]s that implement this trait can be easily converted to [`std::path::Path`]
|
||||
/// or [`std::path::PathBuf`]. This is to encourage/force other Nushell crates to account for
|
||||
/// the emulated current working directory, instead of using the [`std::env::current_dir`].
|
||||
pub trait IsAbsolute: PathForm {}
|
||||
impl IsAbsolute for Absolute {}
|
||||
impl IsAbsolute for Canonical {}
|
||||
|
||||
/// A marker trait that signifies one [`PathForm`] can be used as or trivially converted to
|
||||
/// another [`PathForm`].
|
||||
///
|
||||
/// The list of possible conversions are:
|
||||
/// - [`Relative`], [`Absolute`], or [`Canonical`] into [`Any`].
|
||||
/// - [`Canonical`] into [`Absolute`].
|
||||
/// - Any form into itself.
|
||||
pub trait PathCast<Form: PathForm>: PathForm {}
|
||||
impl<Form: PathForm> PathCast<Form> for Form {}
|
||||
impl PathCast<Any> for Relative {}
|
||||
impl PathCast<Any> for Absolute {}
|
||||
impl PathCast<Any> for Canonical {}
|
||||
impl PathCast<Absolute> for Canonical {}
|
||||
|
||||
/// A trait used to specify the output [`PathForm`] of a path join operation.
|
||||
///
|
||||
/// The output path forms based on the left hand side path form are as follows:
|
||||
///
|
||||
/// | Left hand side | Output form |
|
||||
/// | --------------:|:------------ |
|
||||
/// | [`Any`] | [`Any`] |
|
||||
/// | [`Relative`] | [`Any`] |
|
||||
/// | [`Absolute`] | [`Absolute`] |
|
||||
/// | [`Canonical`] | [`Absolute`] |
|
||||
pub trait PathJoin: PathForm {
|
||||
type Output: PathForm;
|
||||
}
|
||||
impl PathJoin for Any {
|
||||
type Output = Self;
|
||||
}
|
||||
impl PathJoin for Relative {
|
||||
type Output = Any;
|
||||
}
|
||||
impl PathJoin for Absolute {
|
||||
type Output = Self;
|
||||
}
|
||||
impl PathJoin for Canonical {
|
||||
type Output = Absolute;
|
||||
}
|
||||
|
||||
/// A marker trait for [`PathForm`]s that support setting the file name or extension.
|
||||
///
|
||||
/// This includes the [`Any`], [`Relative`], and [`Absolute`] path forms.
|
||||
/// [`Canonical`] paths do not support this, since appending file names and extensions that contain
|
||||
/// path separators can cause the path to no longer be canonical.
|
||||
pub trait PathSet: PathForm {}
|
||||
impl PathSet for Any {}
|
||||
impl PathSet for Relative {}
|
||||
impl PathSet for Absolute {}
|
||||
|
||||
/// A marker trait for [`PathForm`]s that support pushing [`MaybeRelative`] paths.
|
||||
///
|
||||
/// This includes only [`Any`] and [`Absolute`] path forms.
|
||||
/// Pushing onto a [`Relative`] path could cause it to become [`Absolute`],
|
||||
/// which is why they do not support pushing.
|
||||
/// In the future, a `push_rel` and/or a `try_push` method could be added as an alternative.
|
||||
/// Similarly, [`Canonical`] paths may become uncanonical if a non-canonical path is pushed onto it.
|
||||
pub trait PathPush: PathSet {}
|
||||
impl PathPush for Any {}
|
||||
impl PathPush for Absolute {}
|
|
@ -2,12 +2,15 @@ mod assert_path_eq;
|
|||
mod components;
|
||||
pub mod dots;
|
||||
pub mod expansions;
|
||||
pub mod form;
|
||||
mod helpers;
|
||||
mod path;
|
||||
mod tilde;
|
||||
mod trailing_slash;
|
||||
|
||||
pub use components::components;
|
||||
pub use expansions::{canonicalize_with, expand_path_with, expand_to_real_path, locate_in_dirs};
|
||||
pub use helpers::{cache_dir, config_dir, data_dir, get_canonicalized_path, home_dir};
|
||||
pub use path::*;
|
||||
pub use tilde::expand_tilde;
|
||||
pub use trailing_slash::{has_trailing_slash, strip_trailing_slash};
|
||||
|
|
3095
crates/nu-path/src/path.rs
Normal file
3095
crates/nu-path/src/path.rs
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -5,14 +5,14 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-plugin-core
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-plugin-core"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-plugin-protocol = { path = "../nu-plugin-protocol", version = "0.95.0", default-features = false }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
nu-plugin-protocol = { path = "../nu-plugin-protocol", version = "0.95.1", default-features = false }
|
||||
|
||||
rmp-serde = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
|
|
|
@ -5,17 +5,17 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-plugin-engi
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-plugin-engine"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-system = { path = "../nu-system", version = "0.95.0" }
|
||||
nu-plugin-protocol = { path = "../nu-plugin-protocol", version = "0.95.0" }
|
||||
nu-plugin-core = { path = "../nu-plugin-core", version = "0.95.0", default-features = false }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
nu-system = { path = "../nu-system", version = "0.95.1" }
|
||||
nu-plugin-protocol = { path = "../nu-plugin-protocol", version = "0.95.1" }
|
||||
nu-plugin-core = { path = "../nu-plugin-core", version = "0.95.1", default-features = false }
|
||||
|
||||
serde = { workspace = true }
|
||||
log = { workspace = true }
|
||||
|
|
|
@ -5,14 +5,14 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-plugin-prot
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-plugin-protocol"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0", features = ["plugin"] }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1", features = ["plugin"] }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.1" }
|
||||
|
||||
bincode = "1.3"
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "nu-plugin-test-support"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
description = "Testing support for Nushell plugins"
|
||||
|
@ -12,14 +12,14 @@ bench = false
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0", features = ["plugin"] }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0", features = ["plugin"] }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.0", features = ["plugin"] }
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.0" }
|
||||
nu-plugin-core = { path = "../nu-plugin-core", version = "0.95.0" }
|
||||
nu-plugin-engine = { path = "../nu-plugin-engine", version = "0.95.0" }
|
||||
nu-plugin-protocol = { path = "../nu-plugin-protocol", version = "0.95.0" }
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.95.0" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1", features = ["plugin"] }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1", features = ["plugin"] }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.1", features = ["plugin"] }
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.1" }
|
||||
nu-plugin-core = { path = "../nu-plugin-core", version = "0.95.1" }
|
||||
nu-plugin-engine = { path = "../nu-plugin-engine", version = "0.95.1" }
|
||||
nu-plugin-protocol = { path = "../nu-plugin-protocol", version = "0.95.1" }
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.95.1" }
|
||||
nu-ansi-term = { workspace = true }
|
||||
similar = "2.5"
|
||||
|
||||
|
|
|
@ -5,16 +5,16 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-plugin"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-plugin"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-plugin-protocol = { path = "../nu-plugin-protocol", version = "0.95.0" }
|
||||
nu-plugin-core = { path = "../nu-plugin-core", version = "0.95.0", default-features = false }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
nu-plugin-protocol = { path = "../nu-plugin-protocol", version = "0.95.1" }
|
||||
nu-plugin-core = { path = "../nu-plugin-core", version = "0.95.1", default-features = false }
|
||||
|
||||
log = { workspace = true }
|
||||
thiserror = "1.0"
|
||||
|
|
|
@ -5,7 +5,7 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-pretty-hex"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-pretty-hex"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
|
|
@ -5,7 +5,7 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-protocol"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-protocol"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
@ -13,10 +13,10 @@ version = "0.95.0"
|
|||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.0" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.0" }
|
||||
nu-system = { path = "../nu-system", version = "0.95.0" }
|
||||
nu-derive-value = { path = "../nu-derive-value", version = "0.95.0" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.1" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.1" }
|
||||
nu-system = { path = "../nu-system", version = "0.95.1" }
|
||||
nu-derive-value = { path = "../nu-derive-value", version = "0.95.1" }
|
||||
|
||||
brotli = { workspace = true, optional = true }
|
||||
byte-unit = { version = "5.1", features = [ "serde" ] }
|
||||
|
@ -47,7 +47,7 @@ plugin = [
|
|||
serde_json = { workspace = true }
|
||||
strum = "0.26"
|
||||
strum_macros = "0.26"
|
||||
nu-test-support = { path = "../nu-test-support", version = "0.95.0" }
|
||||
nu-test-support = { path = "../nu-test-support", version = "0.95.1" }
|
||||
pretty_assertions = { workspace = true }
|
||||
rstest = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
|
|
|
@ -194,31 +194,11 @@ pub(crate) fn create_nu_constant(engine_state: &EngineState, span: Span) -> Valu
|
|||
// if not, use the default /usr/share/nushell/vendor/autoload
|
||||
|
||||
// check to see if NU_VENDOR_AUTOLOAD_DIR env var is set, if not, use the default
|
||||
Value::string(
|
||||
option_env!("NU_VENDOR_AUTOLOAD_DIR")
|
||||
.map(String::from)
|
||||
.unwrap_or_else(|| {
|
||||
if cfg!(windows) {
|
||||
let all_user_profile = match engine_state.get_env_var("ALLUSERPROFILE") {
|
||||
Some(v) => format!(
|
||||
"{}\\nushell\\vendor\\autoload",
|
||||
v.coerce_string().unwrap_or("C:\\ProgramData".into())
|
||||
),
|
||||
None => "C:\\ProgramData\\nushell\\vendor\\autoload".into(),
|
||||
};
|
||||
all_user_profile
|
||||
} else {
|
||||
// In non-Windows environments, if NU_VENDOR_AUTOLOAD_DIR is not set
|
||||
// check to see if PREFIX env var is set, and use it as PREFIX/nushell/vendor/autoload
|
||||
// otherwise default to /usr/share/nushell/vendor/autoload
|
||||
option_env!("PREFIX").map(String::from).map_or_else(
|
||||
|| "/usr/local/share/nushell/vendor/autoload".into(),
|
||||
|prefix| format!("{}/share/nushell/vendor/autoload", prefix),
|
||||
)
|
||||
}
|
||||
}),
|
||||
span,
|
||||
),
|
||||
if let Some(path) = get_vendor_autoload_dir(engine_state) {
|
||||
Value::string(path.to_string_lossy(), span)
|
||||
} else {
|
||||
Value::error(ShellError::ConfigDirNotFound { span: Some(span) }, span)
|
||||
},
|
||||
);
|
||||
|
||||
record.push("temp-path", {
|
||||
|
@ -275,6 +255,41 @@ pub(crate) fn create_nu_constant(engine_state: &EngineState, span: Span) -> Valu
|
|||
Value::record(record, span)
|
||||
}
|
||||
|
||||
pub fn get_vendor_autoload_dir(engine_state: &EngineState) -> Option<PathBuf> {
|
||||
// pseudo code
|
||||
// if env var NU_VENDOR_AUTOLOAD_DIR is set, in any platform, use it
|
||||
// if not, if windows, use ALLUSERPROFILE\nushell\vendor\autoload
|
||||
// if not, if non-windows, if env var PREFIX is set, use PREFIX/share/nushell/vendor/autoload
|
||||
// if not, use the default /usr/share/nushell/vendor/autoload
|
||||
|
||||
// check to see if NU_VENDOR_AUTOLOAD_DIR env var is set, if not, use the default
|
||||
Some(
|
||||
option_env!("NU_VENDOR_AUTOLOAD_DIR")
|
||||
.map(String::from)
|
||||
.unwrap_or_else(|| {
|
||||
if cfg!(windows) {
|
||||
let all_user_profile = match engine_state.get_env_var("ALLUSERPROFILE") {
|
||||
Some(v) => format!(
|
||||
"{}\\nushell\\vendor\\autoload",
|
||||
v.coerce_string().unwrap_or("C:\\ProgramData".into())
|
||||
),
|
||||
None => "C:\\ProgramData\\nushell\\vendor\\autoload".into(),
|
||||
};
|
||||
all_user_profile
|
||||
} else {
|
||||
// In non-Windows environments, if NU_VENDOR_AUTOLOAD_DIR is not set
|
||||
// check to see if PREFIX env var is set, and use it as PREFIX/nushell/vendor/autoload
|
||||
// otherwise default to /usr/share/nushell/vendor/autoload
|
||||
option_env!("PREFIX").map(String::from).map_or_else(
|
||||
|| "/usr/local/share/nushell/vendor/autoload".into(),
|
||||
|prefix| format!("{}/share/nushell/vendor/autoload", prefix),
|
||||
)
|
||||
}
|
||||
})
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
fn eval_const_call(
|
||||
working_set: &StateWorkingSet,
|
||||
call: &Call,
|
||||
|
|
|
@ -11,6 +11,7 @@ mod example;
|
|||
mod id;
|
||||
mod lev_distance;
|
||||
mod module;
|
||||
pub mod parser_path;
|
||||
mod pipeline;
|
||||
#[cfg(feature = "plugin")]
|
||||
mod plugin;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use crate::{
|
||||
ast::ImportPatternMember, engine::StateWorkingSet, BlockId, DeclId, ModuleId, ParseError, Span,
|
||||
Value, VarId,
|
||||
ast::ImportPatternMember, engine::StateWorkingSet, BlockId, DeclId, FileId, ModuleId,
|
||||
ParseError, Span, Value, VarId,
|
||||
};
|
||||
|
||||
use crate::parser_path::ParserPath;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
pub struct ResolvedImportPattern {
|
||||
|
@ -35,6 +36,8 @@ pub struct Module {
|
|||
pub env_block: Option<BlockId>, // `export-env { ... }` block
|
||||
pub main: Option<DeclId>, // `export def main`
|
||||
pub span: Option<Span>,
|
||||
pub imported_modules: Vec<ModuleId>, // use other_module.nu
|
||||
pub file: Option<(ParserPath, FileId)>,
|
||||
}
|
||||
|
||||
impl Module {
|
||||
|
@ -47,6 +50,8 @@ impl Module {
|
|||
env_block: None,
|
||||
main: None,
|
||||
span: None,
|
||||
imported_modules: vec![],
|
||||
file: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,6 +64,8 @@ impl Module {
|
|||
env_block: None,
|
||||
main: None,
|
||||
span: Some(span),
|
||||
imported_modules: vec![],
|
||||
file: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,6 +89,12 @@ impl Module {
|
|||
self.env_block = Some(block_id);
|
||||
}
|
||||
|
||||
pub fn track_imported_modules(&mut self, module_id: &[ModuleId]) {
|
||||
for m in module_id {
|
||||
self.imported_modules.push(*m)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn has_decl(&self, name: &[u8]) -> bool {
|
||||
if name == self.name && self.main.is_some() {
|
||||
return true;
|
||||
|
@ -90,6 +103,9 @@ impl Module {
|
|||
self.decls.contains_key(name)
|
||||
}
|
||||
|
||||
/// Resolve `members` from given module, which is indicated by `self_id` to import.
|
||||
///
|
||||
/// When resolving, all modules are recorded in `imported_modules`.
|
||||
pub fn resolve_import_pattern(
|
||||
&self,
|
||||
working_set: &StateWorkingSet,
|
||||
|
@ -97,7 +113,9 @@ impl Module {
|
|||
members: &[ImportPatternMember],
|
||||
name_override: Option<&[u8]>, // name under the module was stored (doesn't have to be the same as self.name)
|
||||
backup_span: Span,
|
||||
imported_modules: &mut Vec<ModuleId>,
|
||||
) -> (ResolvedImportPattern, Vec<ParseError>) {
|
||||
imported_modules.push(self_id);
|
||||
let final_name = name_override.unwrap_or(&self.name).to_vec();
|
||||
|
||||
let (head, rest) = if let Some((head, rest)) = members.split_first() {
|
||||
|
@ -112,8 +130,14 @@ impl Module {
|
|||
let submodule = working_set.get_module(*id);
|
||||
let span = submodule.span.or(self.span).unwrap_or(backup_span);
|
||||
|
||||
let (sub_results, sub_errors) =
|
||||
submodule.resolve_import_pattern(working_set, *id, &[], None, span);
|
||||
let (sub_results, sub_errors) = submodule.resolve_import_pattern(
|
||||
working_set,
|
||||
*id,
|
||||
&[],
|
||||
None,
|
||||
span,
|
||||
imported_modules,
|
||||
);
|
||||
errors.extend(sub_errors);
|
||||
|
||||
for (sub_name, sub_decl_id) in sub_results.decls {
|
||||
|
@ -212,6 +236,7 @@ impl Module {
|
|||
rest,
|
||||
None,
|
||||
self.span.unwrap_or(backup_span),
|
||||
imported_modules,
|
||||
)
|
||||
} else {
|
||||
(
|
||||
|
@ -234,6 +259,7 @@ impl Module {
|
|||
&[],
|
||||
None,
|
||||
self.span.unwrap_or(backup_span),
|
||||
imported_modules,
|
||||
);
|
||||
decls.extend(sub_results.decls);
|
||||
|
||||
|
@ -287,6 +313,7 @@ impl Module {
|
|||
rest,
|
||||
None,
|
||||
self.span.unwrap_or(backup_span),
|
||||
imported_modules,
|
||||
);
|
||||
|
||||
decls.extend(sub_results.decls);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use nu_protocol::engine::{StateWorkingSet, VirtualPath};
|
||||
use crate::engine::{StateWorkingSet, VirtualPath};
|
||||
use std::{
|
||||
ffi::OsStr,
|
||||
path::{Path, PathBuf},
|
|
@ -5,12 +5,12 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-std"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-std"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[dependencies]
|
||||
nu-parser = { version = "0.95.0", path = "../nu-parser" }
|
||||
nu-protocol = { version = "0.95.0", path = "../nu-protocol" }
|
||||
nu-engine = { version = "0.95.0", path = "../nu-engine" }
|
||||
nu-parser = { version = "0.95.1", path = "../nu-parser" }
|
||||
nu-protocol = { version = "0.95.1", path = "../nu-protocol" }
|
||||
nu-engine = { version = "0.95.1", path = "../nu-engine" }
|
||||
miette = { workspace = true, features = ["fancy-no-backtrace"] }
|
||||
|
||||
log = "0.4"
|
|
@ -3,7 +3,7 @@ authors = ["The Nushell Project Developers", "procs creators"]
|
|||
description = "Nushell system querying"
|
||||
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-system"
|
||||
name = "nu-system"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
|
||||
|
|
|
@ -5,20 +5,20 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-table"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-table"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.0" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0" }
|
||||
nu-color-config = { path = "../nu-color-config", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.1" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1" }
|
||||
nu-color-config = { path = "../nu-color-config", version = "0.95.1" }
|
||||
nu-ansi-term = { workspace = true }
|
||||
once_cell = { workspace = true }
|
||||
fancy-regex = { workspace = true }
|
||||
tabled = { workspace = true, features = ["color"], default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
# nu-test-support = { path="../nu-test-support", version = "0.95.0" }
|
||||
# nu-test-support = { path="../nu-test-support", version = "0.95.1" }
|
|
@ -5,12 +5,12 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-term-grid"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-term-grid"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.0" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.1" }
|
||||
|
||||
unicode-width = { workspace = true }
|
|
@ -5,16 +5,16 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-test-suppor
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu-test-support"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-path = { path = "../nu-path", version = "0.95.0" }
|
||||
nu-glob = { path = "../nu-glob", version = "0.95.0" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.0" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.1" }
|
||||
nu-glob = { path = "../nu-glob", version = "0.95.1" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.1" }
|
||||
|
||||
num-format = { workspace = true }
|
||||
which = { workspace = true }
|
||||
|
|
|
@ -5,7 +5,7 @@ edition = "2021"
|
|||
license = "MIT"
|
||||
name = "nu-utils"
|
||||
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-utils"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[[bin]]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Nushell Config File
|
||||
#
|
||||
# version = "0.95.0"
|
||||
# version = "0.95.1"
|
||||
|
||||
# For more information on defining custom themes, see
|
||||
# https://www.nushell.sh/book/coloring_and_theming.html
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Nushell Environment Config File
|
||||
#
|
||||
# version = "0.95.0"
|
||||
# version = "0.95.1"
|
||||
|
||||
def create_left_prompt [] {
|
||||
let dir = match (do --ignore-shell-errors { $env.PWD | path relative-to $nu.home-path }) {
|
||||
|
|
|
@ -10,10 +10,10 @@ name = "nu_plugin_custom_values"
|
|||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0", features = ["plugin"] }
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1", features = ["plugin"] }
|
||||
serde = { workspace = true, default-features = false }
|
||||
typetag = "0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
nu-plugin-test-support = { path = "../nu-plugin-test-support", version = "0.95.0" }
|
||||
nu-plugin-test-support = { path = "../nu-plugin-test-support", version = "0.95.1" }
|
|
@ -5,7 +5,7 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu_plugin_exam
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_example"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[[bin]]
|
||||
name = "nu_plugin_example"
|
||||
|
@ -15,9 +15,9 @@ bench = false
|
|||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0", features = ["plugin"] }
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1", features = ["plugin"] }
|
||||
|
||||
[dev-dependencies]
|
||||
nu-plugin-test-support = { path = "../nu-plugin-test-support", version = "0.95.0" }
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.95.0" }
|
||||
nu-plugin-test-support = { path = "../nu-plugin-test-support", version = "0.95.1" }
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.95.1" }
|
|
@ -1,10 +1,37 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
use nu_plugin::{EngineInterface, EvaluatedCall, SimplePluginCommand};
|
||||
use nu_protocol::{Category, LabeledError, Signature, Type, Value};
|
||||
use nu_protocol::{Category, FromValue, LabeledError, Signature, Spanned, Type, Value};
|
||||
|
||||
use crate::ExamplePlugin;
|
||||
|
||||
pub struct Config;
|
||||
|
||||
/// Example config struct.
|
||||
///
|
||||
/// Using the `FromValue` derive macro, structs can be easily loaded from [`Value`]s,
|
||||
/// similar to serde's `Deserialize` macro.
|
||||
/// This is handy for plugin configs or piped data.
|
||||
/// All fields must implement [`FromValue`].
|
||||
/// For [`Option`] fields, they can be omitted in the config.
|
||||
///
|
||||
/// This example shows that nested and spanned data work too, so you can describe nested
|
||||
/// structures and get spans of values wrapped in [`Spanned`].
|
||||
/// Since this config uses only `Option`s, no field is required in the config.
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, FromValue)]
|
||||
struct PluginConfig {
|
||||
path: Option<Spanned<PathBuf>>,
|
||||
nested: Option<SubConfig>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, FromValue)]
|
||||
struct SubConfig {
|
||||
bool: bool,
|
||||
string: String,
|
||||
}
|
||||
|
||||
impl SimplePluginCommand for Config {
|
||||
type Plugin = ExamplePlugin;
|
||||
|
||||
|
@ -39,7 +66,11 @@ impl SimplePluginCommand for Config {
|
|||
) -> Result<Value, LabeledError> {
|
||||
let config = engine.get_plugin_config()?;
|
||||
match config {
|
||||
Some(config) => Ok(config.clone()),
|
||||
Some(value) => {
|
||||
let config = PluginConfig::from_value(value.clone())?;
|
||||
println!("got config {config:?}");
|
||||
Ok(value)
|
||||
}
|
||||
None => Err(LabeledError::new("No config sent").with_label(
|
||||
"configuration for this plugin was not found in `$env.config.plugins.example`",
|
||||
call.head,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use nu_plugin::{EngineInterface, EvaluatedCall, SimplePluginCommand};
|
||||
use nu_protocol::{record, Category, LabeledError, Signature, SyntaxShape, Value};
|
||||
use nu_protocol::{Category, IntoValue, LabeledError, Signature, SyntaxShape, Value};
|
||||
|
||||
use crate::ExamplePlugin;
|
||||
|
||||
|
@ -38,14 +38,22 @@ impl SimplePluginCommand for Two {
|
|||
) -> Result<Value, LabeledError> {
|
||||
plugin.print_values(2, call, input)?;
|
||||
|
||||
// Use the IntoValue derive macro and trait to easily design output data.
|
||||
#[derive(IntoValue)]
|
||||
struct Output {
|
||||
one: i64,
|
||||
two: i64,
|
||||
three: i64,
|
||||
}
|
||||
|
||||
let vals = (0..10i64)
|
||||
.map(|i| {
|
||||
let record = record! {
|
||||
"one" => Value::int(i, call.head),
|
||||
"two" => Value::int(2 * i, call.head),
|
||||
"three" => Value::int(3 * i, call.head),
|
||||
};
|
||||
Value::record(record, call.head)
|
||||
Output {
|
||||
one: i,
|
||||
two: 2 * i,
|
||||
three: 3 * i,
|
||||
}
|
||||
.into_value(call.head)
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu_plugin_form
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_formats"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0", features = ["plugin"] }
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1", features = ["plugin"] }
|
||||
|
||||
indexmap = { workspace = true }
|
||||
eml-parser = "0.1"
|
||||
|
@ -18,4 +18,4 @@ ical = "0.11"
|
|||
rust-ini = "0.21.0"
|
||||
|
||||
[dev-dependencies]
|
||||
nu-plugin-test-support = { path = "../nu-plugin-test-support", version = "0.95.0" }
|
||||
nu-plugin-test-support = { path = "../nu-plugin-test-support", version = "0.95.1" }
|
|
@ -5,7 +5,7 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu_plugin_gsta
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_gstat"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -16,7 +16,7 @@ name = "nu_plugin_gstat"
|
|||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
|
||||
git2 = "0.19"
|
|
@ -5,7 +5,7 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu_plugin_inc"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_inc"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -16,7 +16,7 @@ name = "nu_plugin_inc"
|
|||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0", features = ["plugin"] }
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1", features = ["plugin"] }
|
||||
|
||||
semver = "1.0"
|
|
@ -6,7 +6,7 @@
|
|||
# it also allows us to test the plugin interface with something manually implemented in a scripting
|
||||
# language without adding any extra dependencies to our tests.
|
||||
|
||||
const NUSHELL_VERSION = "0.95.0"
|
||||
const NUSHELL_VERSION = "0.95.1"
|
||||
const PLUGIN_VERSION = "0.1.0" # bump if you change commands!
|
||||
|
||||
def main [--stdio] {
|
||||
|
|
|
@ -5,7 +5,7 @@ edition = "2021"
|
|||
license = "MIT"
|
||||
name = "nu_plugin_polars"
|
||||
repository = "https://github.com/nushell/nushell/tree/main/crates/nu_plugin_polars"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
@ -17,10 +17,10 @@ bench = false
|
|||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.0" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.0" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.1" }
|
||||
nu-path = { path = "../nu-path", version = "0.95.1" }
|
||||
nu-utils = { path = "../nu-utils", version = "0.95.1" }
|
||||
|
||||
# Potential dependencies for extras
|
||||
chrono = { workspace = true, features = ["std", "unstable-locales"], default-features = false }
|
||||
|
@ -37,9 +37,9 @@ polars-ops = { version = "0.40"}
|
|||
polars-plan = { version = "0.40", features = ["regex"]}
|
||||
polars-utils = { version = "0.40"}
|
||||
typetag = "0.2"
|
||||
uuid = { version = "1.7", features = ["v4", "serde"] }
|
||||
env_logger = "0.11.3"
|
||||
log.workspace = true
|
||||
uuid = { version = "1.9", features = ["v4", "serde"] }
|
||||
|
||||
[dependencies.polars]
|
||||
features = [
|
||||
|
@ -76,9 +76,9 @@ optional = false
|
|||
version = "0.40"
|
||||
|
||||
[dev-dependencies]
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.95.0" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.0" }
|
||||
nu-command = { path = "../nu-command", version = "0.95.0" }
|
||||
nu-plugin-test-support = { path = "../nu-plugin-test-support", version = "0.95.0" }
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.95.1" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.1" }
|
||||
nu-command = { path = "../nu-command", version = "0.95.1" }
|
||||
nu-plugin-test-support = { path = "../nu-plugin-test-support", version = "0.95.1" }
|
||||
tempfile.workspace = true
|
||||
|
|
|
@ -27,7 +27,7 @@ import sys
|
|||
import json
|
||||
|
||||
|
||||
NUSHELL_VERSION = "0.95.0"
|
||||
NUSHELL_VERSION = "0.95.1"
|
||||
PLUGIN_VERSION = "0.1.0" # bump if you change commands!
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu_plugin_quer
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_query"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
@ -16,8 +16,8 @@ name = "nu_plugin_query"
|
|||
bench = false
|
||||
|
||||
[dependencies]
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-plugin = { path = "../nu-plugin", version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
|
||||
gjson = "0.8"
|
||||
scraper = { default-features = false, version = "0.19" }
|
||||
|
|
|
@ -5,7 +5,7 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu_plugin_stre
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_stress_internals"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
[[bin]]
|
||||
name = "nu_plugin_stress_internals"
|
||||
|
|
|
@ -5,14 +5,14 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nuon"
|
|||
edition = "2021"
|
||||
license = "MIT"
|
||||
name = "nuon"
|
||||
version = "0.95.0"
|
||||
version = "0.95.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.0" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.0" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.0" }
|
||||
nu-parser = { path = "../nu-parser", version = "0.95.1" }
|
||||
nu-protocol = { path = "../nu-protocol", version = "0.95.1" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.95.1" }
|
||||
once_cell = { workspace = true }
|
||||
fancy-regex = { workspace = true }
|
||||
|
||||
|
|
|
@ -9,8 +9,9 @@ use nu_protocol::{
|
|||
};
|
||||
use nu_utils::{get_default_config, get_default_env};
|
||||
use std::{
|
||||
fs,
|
||||
fs::File,
|
||||
io::Write,
|
||||
io::{Result, Write},
|
||||
panic::{catch_unwind, AssertUnwindSafe},
|
||||
path::Path,
|
||||
sync::Arc,
|
||||
|
@ -176,6 +177,46 @@ pub(crate) fn read_default_env_file(engine_state: &mut EngineState, stack: &mut
|
|||
}
|
||||
}
|
||||
|
||||
fn read_and_sort_directory(path: &Path) -> Result<Vec<String>> {
|
||||
let mut entries = Vec::new();
|
||||
|
||||
for entry in fs::read_dir(path)? {
|
||||
let entry = entry?;
|
||||
let file_name = entry.file_name();
|
||||
let file_name_str = file_name.into_string().unwrap_or_default();
|
||||
entries.push(file_name_str);
|
||||
}
|
||||
|
||||
entries.sort();
|
||||
|
||||
Ok(entries)
|
||||
}
|
||||
|
||||
pub(crate) fn read_vendor_autoload_files(engine_state: &mut EngineState, stack: &mut Stack) {
|
||||
warn!(
|
||||
"read_vendor_autoload_files() {}:{}:{}",
|
||||
file!(),
|
||||
line!(),
|
||||
column!()
|
||||
);
|
||||
|
||||
// read and source vendor_autoload_files file if exists
|
||||
if let Some(autoload_dir) = nu_protocol::eval_const::get_vendor_autoload_dir(engine_state) {
|
||||
warn!("read_vendor_autoload_files: {}", autoload_dir.display());
|
||||
|
||||
if autoload_dir.exists() {
|
||||
let entries = read_and_sort_directory(&autoload_dir);
|
||||
if let Ok(entries) = entries {
|
||||
for entry in entries {
|
||||
let path = autoload_dir.join(entry);
|
||||
warn!("AutoLoading: {:?}", path);
|
||||
eval_config_contents(path, engine_state, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn eval_default_config(
|
||||
engine_state: &mut EngineState,
|
||||
stack: &mut Stack,
|
||||
|
@ -236,6 +277,8 @@ pub(crate) fn setup_config(
|
|||
if is_login_shell {
|
||||
read_loginshell_file(engine_state, stack);
|
||||
}
|
||||
// read and auto load vendor autoload files
|
||||
read_vendor_autoload_files(engine_state, stack);
|
||||
}));
|
||||
if result.is_err() {
|
||||
eprintln!(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||
use nu_test_support::fs::Stub::{FileWithContent, FileWithContentToBeTrimmed};
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, nu_repl_code};
|
||||
use pretty_assertions::assert_eq;
|
||||
|
@ -760,3 +760,162 @@ fn nested_list_export_works() {
|
|||
let actual = nu!(&inp.join("; "));
|
||||
assert_eq!(actual.out, "bacon");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reload_submodules() {
|
||||
Playground::setup("reload_submodule_changed_file", |dirs, sandbox| {
|
||||
sandbox.with_files(&[
|
||||
FileWithContent("voice.nu", r#"export module animals.nu"#),
|
||||
FileWithContent("animals.nu", "export def cat [] { 'meow'}"),
|
||||
]);
|
||||
|
||||
let inp = [
|
||||
"use voice.nu",
|
||||
r#""export def cat [] {'woem'}" | save -f animals.nu"#,
|
||||
"use voice.nu",
|
||||
"(voice animals cat) == 'woem'",
|
||||
];
|
||||
let actual = nu!(cwd: dirs.test(), nu_repl_code(&inp));
|
||||
assert_eq!(actual.out, "true");
|
||||
|
||||
// should also verify something unchanged if `use voice`.
|
||||
let inp = [
|
||||
"use voice.nu",
|
||||
r#""export def cat [] {'meow'}" | save -f animals.nu"#,
|
||||
"use voice",
|
||||
"(voice animals cat) == 'woem'",
|
||||
];
|
||||
let actual = nu!(cwd: dirs.test(), nu_repl_code(&inp));
|
||||
assert_eq!(actual.out, "true");
|
||||
|
||||
// should also works if we use members directly.
|
||||
sandbox.with_files(&[
|
||||
FileWithContent("voice.nu", r#"export module animals.nu"#),
|
||||
FileWithContent("animals.nu", "export def cat [] { 'meow'}"),
|
||||
]);
|
||||
let inp = [
|
||||
"use voice.nu animals cat",
|
||||
r#""export def cat [] {'woem'}" | save -f animals.nu"#,
|
||||
"use voice.nu animals cat",
|
||||
"(cat) == 'woem'",
|
||||
];
|
||||
let actual = nu!(cwd: dirs.test(), nu_repl_code(&inp));
|
||||
assert_eq!(actual.out, "true");
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn use_submodules() {
|
||||
Playground::setup("use_submodules", |dirs, sandbox| {
|
||||
sandbox.with_files(&[
|
||||
FileWithContent("voice.nu", r#"export use animals.nu"#),
|
||||
FileWithContent("animals.nu", "export def cat [] { 'meow'}"),
|
||||
]);
|
||||
|
||||
let inp = [
|
||||
"use voice.nu",
|
||||
r#""export def cat [] {'woem'}" | save -f animals.nu"#,
|
||||
"use voice.nu",
|
||||
"(voice animals cat) == 'woem'",
|
||||
];
|
||||
let actual = nu!(cwd: dirs.test(), nu_repl_code(&inp));
|
||||
assert_eq!(actual.out, "true");
|
||||
|
||||
// should also verify something unchanged if `use voice`.
|
||||
let inp = [
|
||||
"use voice.nu",
|
||||
r#""export def cat [] {'meow'}" | save -f animals.nu"#,
|
||||
"use voice",
|
||||
"(voice animals cat) == 'woem'",
|
||||
];
|
||||
let actual = nu!(cwd: dirs.test(), nu_repl_code(&inp));
|
||||
assert_eq!(actual.out, "true");
|
||||
|
||||
// also verify something is changed when using members.
|
||||
sandbox.with_files(&[
|
||||
FileWithContent("voice.nu", r#"export use animals.nu cat"#),
|
||||
FileWithContent("animals.nu", "export def cat [] { 'meow'}"),
|
||||
]);
|
||||
let inp = [
|
||||
"use voice.nu",
|
||||
r#""export def cat [] {'woem'}" | save -f animals.nu"#,
|
||||
"use voice.nu",
|
||||
"(voice cat) == 'woem'",
|
||||
];
|
||||
let actual = nu!(cwd: dirs.test(), nu_repl_code(&inp));
|
||||
assert_eq!(actual.out, "true");
|
||||
|
||||
sandbox.with_files(&[
|
||||
FileWithContent("voice.nu", r#"export use animals.nu *"#),
|
||||
FileWithContent("animals.nu", "export def cat [] { 'meow'}"),
|
||||
]);
|
||||
let inp = [
|
||||
"use voice.nu",
|
||||
r#""export def cat [] {'woem'}" | save -f animals.nu"#,
|
||||
"use voice.nu",
|
||||
"(voice cat) == 'woem'",
|
||||
];
|
||||
let actual = nu!(cwd: dirs.test(), nu_repl_code(&inp));
|
||||
assert_eq!(actual.out, "true");
|
||||
|
||||
sandbox.with_files(&[
|
||||
FileWithContent("voice.nu", r#"export use animals.nu [cat]"#),
|
||||
FileWithContent("animals.nu", "export def cat [] { 'meow'}"),
|
||||
]);
|
||||
let inp = [
|
||||
"use voice.nu",
|
||||
r#""export def cat [] {'woem'}" | save -f animals.nu"#,
|
||||
"use voice.nu",
|
||||
"(voice cat) == 'woem'",
|
||||
];
|
||||
let actual = nu!(cwd: dirs.test(), nu_repl_code(&inp));
|
||||
assert_eq!(actual.out, "true");
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn use_nested_submodules() {
|
||||
Playground::setup("use_submodules", |dirs, sandbox| {
|
||||
sandbox.with_files(&[
|
||||
FileWithContent("voice.nu", r#"export use animals.nu"#),
|
||||
FileWithContent("animals.nu", r#"export use nested_animals.nu"#),
|
||||
FileWithContent("nested_animals.nu", "export def cat [] { 'meow'}"),
|
||||
]);
|
||||
let inp = [
|
||||
"use voice.nu",
|
||||
r#""export def cat [] {'woem'}" | save -f nested_animals.nu"#,
|
||||
"use voice.nu",
|
||||
"(voice animals nested_animals cat) == 'woem'",
|
||||
];
|
||||
let actual = nu!(cwd: dirs.test(), nu_repl_code(&inp));
|
||||
assert_eq!(actual.out, "true");
|
||||
|
||||
sandbox.with_files(&[
|
||||
FileWithContent("voice.nu", r#"export use animals.nu"#),
|
||||
FileWithContent("animals.nu", r#"export use nested_animals.nu cat"#),
|
||||
FileWithContent("nested_animals.nu", "export def cat [] { 'meow'}"),
|
||||
]);
|
||||
let inp = [
|
||||
"use voice.nu",
|
||||
r#""export def cat [] {'woem'}" | save -f nested_animals.nu"#,
|
||||
"use voice.nu",
|
||||
"(voice animals cat) == 'woem'",
|
||||
];
|
||||
let actual = nu!(cwd: dirs.test(), nu_repl_code(&inp));
|
||||
assert_eq!(actual.out, "true");
|
||||
|
||||
sandbox.with_files(&[
|
||||
FileWithContent("animals.nu", r#"export use nested_animals.nu cat"#),
|
||||
FileWithContent("nested_animals.nu", "export def cat [] { 'meow' }"),
|
||||
]);
|
||||
let inp = [
|
||||
"module voice { export module animals.nu }",
|
||||
"use voice",
|
||||
r#""export def cat [] {'woem'}" | save -f nested_animals.nu"#,
|
||||
"use voice.nu",
|
||||
"(voice animals cat) == 'woem'",
|
||||
];
|
||||
let actual = nu!(cwd: dirs.test(), nu_repl_code(&inp));
|
||||
assert_eq!(actual.out, "true");
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,27 +1,5 @@
|
|||
use nu_test_support::nu_with_plugins;
|
||||
|
||||
#[test]
|
||||
fn closure() {
|
||||
let actual = nu_with_plugins!(
|
||||
cwd: "tests",
|
||||
plugin: ("nu_plugin_example"),
|
||||
r#"
|
||||
$env.env_value = "value from env"
|
||||
|
||||
$env.config = {
|
||||
plugins: {
|
||||
example: {||
|
||||
$env.env_value
|
||||
}
|
||||
}
|
||||
}
|
||||
example config
|
||||
"#
|
||||
);
|
||||
|
||||
assert!(actual.out.contains("value from env"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn none() {
|
||||
let actual = nu_with_plugins!(
|
||||
|
@ -34,7 +12,7 @@ fn none() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn record() {
|
||||
fn some() {
|
||||
let actual = nu_with_plugins!(
|
||||
cwd: "tests",
|
||||
plugin: ("nu_plugin_example"),
|
||||
|
@ -42,8 +20,11 @@ fn record() {
|
|||
$env.config = {
|
||||
plugins: {
|
||||
example: {
|
||||
key1: "value"
|
||||
key2: "other"
|
||||
path: "some/path",
|
||||
nested: {
|
||||
bool: true,
|
||||
string: "Hello Example!"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +32,6 @@ fn record() {
|
|||
"#
|
||||
);
|
||||
|
||||
assert!(actual.out.contains("value"));
|
||||
assert!(actual.out.contains("other"));
|
||||
assert!(actual.out.contains("some/path"));
|
||||
assert!(actual.out.contains("Hello Example!"));
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ extend-ignore-re = [
|
|||
"--find ba\\b",
|
||||
"0x\\[ba be\\]",
|
||||
"\\)BaR'",
|
||||
"fo<66>.txt",
|
||||
]
|
||||
|
||||
[type.rust.extend-words]
|
||||
|
|
Loading…
Reference in New Issue
Block a user