2021-01-12 05:59:53 +01:00
|
|
|
[package]
|
2022-03-22 21:25:38 +01:00
|
|
|
authors = ["The Nushell Project Developers"]
|
2022-04-11 20:17:06 +02:00
|
|
|
description = "Nushell's built-in commands"
|
2022-03-22 21:25:38 +01:00
|
|
|
edition = "2021"
|
|
|
|
license = "MIT"
|
2021-01-12 05:59:53 +01:00
|
|
|
name = "nu-command"
|
2023-02-11 19:59:11 +01:00
|
|
|
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-command"
|
2024-04-12 15:00:43 +02:00
|
|
|
version = "0.92.3"
|
2021-12-11 21:08:17 +01:00
|
|
|
|
2021-09-02 03:29:43 +02:00
|
|
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
|
|
|
2023-02-12 23:22:00 +01:00
|
|
|
[lib]
|
|
|
|
bench = false
|
|
|
|
|
2021-09-02 03:29:43 +02:00
|
|
|
[dependencies]
|
2024-04-12 15:00:43 +02:00
|
|
|
nu-cmd-base = { path = "../nu-cmd-base", version = "0.92.3" }
|
|
|
|
nu-color-config = { path = "../nu-color-config", version = "0.92.3" }
|
|
|
|
nu-engine = { path = "../nu-engine", version = "0.92.3" }
|
|
|
|
nu-glob = { path = "../nu-glob", version = "0.92.3" }
|
|
|
|
nu-json = { path = "../nu-json", version = "0.92.3" }
|
|
|
|
nu-parser = { path = "../nu-parser", version = "0.92.3" }
|
|
|
|
nu-path = { path = "../nu-path", version = "0.92.3" }
|
|
|
|
nu-pretty-hex = { path = "../nu-pretty-hex", version = "0.92.3" }
|
|
|
|
nu-protocol = { path = "../nu-protocol", version = "0.92.3" }
|
|
|
|
nu-system = { path = "../nu-system", version = "0.92.3" }
|
|
|
|
nu-table = { path = "../nu-table", version = "0.92.3" }
|
|
|
|
nu-term-grid = { path = "../nu-term-grid", version = "0.92.3" }
|
|
|
|
nu-utils = { path = "../nu-utils", version = "0.92.3" }
|
2024-03-07 23:40:31 +01:00
|
|
|
nu-ansi-term = { workspace = true }
|
create `nuon` crate from `from nuon` and `to nuon` (#12553)
# Description
playing with the NUON format in Rust code in some plugins, we agreed
with the team it was a great time to create a standalone NUON format to
allow Rust devs to use this Nushell file format.
> **Note**
> this PR almost copy-pastes the code from
`nu_commands/src/formats/from/nuon.rs` and
`nu_commands/src/formats/to/nuon.rs` to `nuon/src/from.rs` and
`nuon/src/to.rs`, with minor tweaks to make then standalone functions,
e.g. remove the rest of the command implementations
### TODO
- [x] add tests
- [x] add documentation
# User-Facing Changes
devs will have access to a new crate, `nuon`, and two functions,
`from_nuon` and `to_nuon`
```rust
from_nuon(
input: &str,
span: Option<Span>,
) -> Result<Value, ShellError>
```
```rust
to_nuon(
input: &Value,
raw: bool,
tabs: Option<usize>,
indent: Option<usize>,
span: Option<Span>,
) -> Result<String, ShellError>
```
# Tests + Formatting
i've basically taken all the tests from
`crates/nu-command/tests/format_conversions/nuon.rs` and converted them
to use `from_nuon` and `to_nuon` instead of Nushell commands
- i've created a `nuon_end_to_end` to run both conversions with an
optional middle value to check that all is fine
> **Note**
> the `nuon::tests::read_code_should_fail_rather_than_panic` test does
give different results locally and in the CI...
> i've left it ignored with comments to help future us :)
# After Submitting
mention that in the release notes for sure!!
2024-04-19 13:54:16 +02:00
|
|
|
nuon = { path = "../nuon", version = "0.92.3" }
|
2023-03-14 19:46:42 +01:00
|
|
|
|
2024-03-24 00:46:02 +01:00
|
|
|
alphanumeric-sort = { workspace = true }
|
|
|
|
base64 = { workspace = true }
|
|
|
|
bracoxide = { workspace = true }
|
2024-04-26 13:23:16 +02:00
|
|
|
brotli = { workspace = true }
|
2024-03-24 00:46:02 +01:00
|
|
|
byteorder = { workspace = true }
|
|
|
|
bytesize = { workspace = true }
|
|
|
|
calamine = { workspace = true, features = ["dates"] }
|
|
|
|
chardetng = { workspace = true }
|
2024-03-07 23:40:31 +01:00
|
|
|
chrono = { workspace = true, features = ["std", "unstable-locales", "clock"], default-features = false }
|
2024-03-24 00:46:02 +01:00
|
|
|
chrono-humanize = { workspace = true }
|
|
|
|
chrono-tz = { workspace = true }
|
2024-03-07 23:40:31 +01:00
|
|
|
crossterm = { workspace = true }
|
2024-03-24 00:46:02 +01:00
|
|
|
csv = { workspace = true }
|
|
|
|
dialoguer = { workspace = true, default-features = false, features = ["fuzzy-select"] }
|
|
|
|
digest = { workspace = true, default-features = false }
|
|
|
|
dtparse = { workspace = true }
|
|
|
|
encoding_rs = { workspace = true }
|
2024-03-07 23:40:31 +01:00
|
|
|
fancy-regex = { workspace = true }
|
2024-03-24 00:46:02 +01:00
|
|
|
filesize = { workspace = true }
|
|
|
|
filetime = { workspace = true }
|
|
|
|
fs_extra = { workspace = true }
|
|
|
|
human-date-parser = { workspace = true }
|
|
|
|
indexmap = { workspace = true }
|
|
|
|
indicatif = { workspace = true }
|
|
|
|
itertools = { workspace = true }
|
2024-03-07 23:40:31 +01:00
|
|
|
log = { workspace = true }
|
2024-03-24 00:46:02 +01:00
|
|
|
lscolors = { workspace = true, default-features = false, features = ["nu-ansi-term"] }
|
|
|
|
md5 = { workspace = true }
|
|
|
|
mime = { workspace = true }
|
|
|
|
mime_guess = { workspace = true }
|
|
|
|
native-tls = { workspace = true }
|
|
|
|
notify-debouncer-full = { workspace = true, default-features = false }
|
|
|
|
num-format = { workspace = true }
|
|
|
|
num-traits = { workspace = true }
|
2024-03-07 23:40:31 +01:00
|
|
|
once_cell = { workspace = true }
|
2024-03-24 00:46:02 +01:00
|
|
|
open = { workspace = true }
|
|
|
|
os_pipe = { workspace = true }
|
2024-03-07 23:40:31 +01:00
|
|
|
pathdiff = { workspace = true }
|
|
|
|
percent-encoding = { workspace = true }
|
2024-03-24 00:46:02 +01:00
|
|
|
print-positions = { workspace = true }
|
|
|
|
quick-xml = { workspace = true }
|
|
|
|
rand = { workspace = true }
|
|
|
|
rayon = { workspace = true }
|
|
|
|
regex = { workspace = true }
|
|
|
|
roxmltree = { workspace = true }
|
|
|
|
rusqlite = { workspace = true, features = ["bundled", "backup", "chrono"], optional = true }
|
2024-04-26 13:23:16 +02:00
|
|
|
rmp = { workspace = true }
|
2024-03-24 00:46:02 +01:00
|
|
|
same-file = { workspace = true }
|
|
|
|
serde = { workspace = true, features = ["derive"] }
|
2024-03-07 23:40:31 +01:00
|
|
|
serde_json = { workspace = true, features = ["preserve_order"] }
|
2024-03-24 00:46:02 +01:00
|
|
|
serde_urlencoded = { workspace = true }
|
|
|
|
serde_yaml = { workspace = true }
|
|
|
|
sha2 = { workspace = true }
|
2024-03-07 23:40:31 +01:00
|
|
|
sysinfo = { workspace = true }
|
2024-03-24 00:46:02 +01:00
|
|
|
tabled = { workspace = true, features = ["color"], default-features = false }
|
|
|
|
terminal_size = { workspace = true }
|
|
|
|
titlecase = { workspace = true }
|
|
|
|
toml = { workspace = true }
|
2024-03-07 23:40:31 +01:00
|
|
|
unicode-segmentation = { workspace = true }
|
2024-03-24 00:46:02 +01:00
|
|
|
ureq = { workspace = true, default-features = false, features = ["charset", "gzip", "json", "native-tls"] }
|
|
|
|
url = { workspace = true }
|
|
|
|
uu_cp = { workspace = true }
|
|
|
|
uu_mkdir = { workspace = true }
|
|
|
|
uu_mktemp = { workspace = true }
|
|
|
|
uu_mv = { workspace = true }
|
2024-03-25 22:51:50 +01:00
|
|
|
uu_uname = { workspace = true }
|
2024-03-24 00:46:02 +01:00
|
|
|
uu_whoami = { workspace = true }
|
2024-03-07 23:40:31 +01:00
|
|
|
uuid = { workspace = true, features = ["v4"] }
|
2024-03-24 00:46:02 +01:00
|
|
|
v_htmlescape = { workspace = true }
|
|
|
|
wax = { workspace = true }
|
2024-03-07 23:40:31 +01:00
|
|
|
which = { workspace = true, optional = true }
|
2024-03-26 06:57:55 +01:00
|
|
|
unicode-width = { workspace = true }
|
2021-05-12 03:01:31 +02:00
|
|
|
|
2022-10-07 20:54:36 +02:00
|
|
|
[target.'cfg(windows)'.dependencies]
|
2024-03-24 00:46:02 +01:00
|
|
|
winreg = { workspace = true }
|
2022-10-07 20:54:36 +02:00
|
|
|
|
2024-03-14 22:43:42 +01:00
|
|
|
[target.'cfg(not(windows))'.dependencies]
|
2024-03-24 00:46:02 +01:00
|
|
|
uucore = { workspace = true, features = ["mode"] }
|
2024-03-14 22:43:42 +01:00
|
|
|
|
2021-01-12 05:59:53 +01:00
|
|
|
[target.'cfg(unix)'.dependencies]
|
2024-03-24 00:46:02 +01:00
|
|
|
umask = { workspace = true }
|
2024-03-30 14:49:54 +01:00
|
|
|
nix = { workspace = true, default-features = false, features = ["user", "resource", "pthread"] }
|
2021-01-12 05:59:53 +01:00
|
|
|
|
Fix build for BSDs (#11372)
# Description
This PR fixes build for BSD variants (including FreeBSD and NetBSD).
Currently, `procfs` only support linux, android and l4re, and
0cba269d80953bc391070bdc8e878d276ecd1180 only adds support for NetBSD,
this PR should work on all BSD variants.
https://github.com/eminence/procfs/blob/b153b782a5957aa619ed744d0ac8bbe4734601ed/procfs/build.rs#L4-L8
Fixes #11373
# User-Facing Changes
* before
```console
nibon7@fbsd /d/s/nushell ((70f7db14))> cargo build
Compiling tempfile v3.8.1
Compiling procfs v0.16.0
Compiling toml_edit v0.21.0
Compiling native-tls v0.2.11
error: failed to run custom build command for `procfs v0.16.0`
Caused by:
process didn't exit successfully: `/data/source/nushell/target/debug/build/procfs-d59599f40f32f0d5/build-script-build` (exit status: 1)
--- stderr
Building procfs on an for a unsupported platform. Currently only linux and android are supported
(Your current target_os is freebsd)
warning: build failed, waiting for other jobs to finish...
```
* after
```console
nushell on bsd [✘!?] is 📦 v0.88.2 via 🦀 v1.74.1
❯ version
╭────────────────────┬───────────────────────────────────────────╮
│ version │ 0.88.2 │
│ branch │ bsd │
│ commit_hash │ 151edef186470e454367ac6e4b2178188062c1f9 │
│ build_os │ freebsd-x86_64 │
│ build_target │ x86_64-unknown-freebsd │
│ rust_version │ rustc 1.74.1 (a28077b28 2023-12-04) │
│ rust_channel │ stable-x86_64-unknown-freebsd │
│ cargo_version │ cargo 1.74.1 (ecb9851af 2023-10-18) │
│ build_time │ 2023-12-19 10:12:15 +00:00 │
│ build_rust_channel │ debug │
│ allocator │ mimalloc │
│ features │ default, extra, sqlite, trash, which, zip │
│ installed_plugins │ │
╰────────────────────┴───────────────────────────────────────────╯
nushell on bsd [✘!?] is 📦 v0.88.2 via 🦀 v1.74.1
❯ cargo test --workspace commands::ulimit e>> /dev/null | rg ulimit
test commands::ulimit::limit_set_filesize2 ... ok
test commands::ulimit::limit_set_filesize1 ... ok
test commands::ulimit::limit_set_hard1 ... ok
test commands::ulimit::limit_set_hard2 ... ok
test commands::ulimit::limit_set_invalid1 ... ok
test commands::ulimit::limit_set_invalid3 ... ok
test commands::ulimit::limit_set_invalid4 ... ok
test commands::ulimit::limit_set_invalid5 ... ok
test commands::ulimit::limit_set_soft2 ... ok
test commands::ulimit::limit_set_soft1 ... ok
nushell on bsd [✘!?] is 📦 v0.88.2 via 🦀 v1.74.1
```
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to
check that you're using the standard code style
- `cargo test --workspace` to check that all tests pass (on Windows make
sure to [enable developer
mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging))
- `cargo run -- -c "use std testing; testing run-tests --path
crates/nu-std"` to run the tests for the standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
2023-12-19 15:58:45 +01:00
|
|
|
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
|
2024-03-24 00:46:02 +01:00
|
|
|
procfs = { workspace = true }
|
2023-11-20 21:22:35 +01:00
|
|
|
|
2022-03-26 19:21:19 +01:00
|
|
|
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies.trash]
|
|
|
|
optional = true
|
2024-03-24 00:46:02 +01:00
|
|
|
workspace = true
|
2022-03-26 19:21:19 +01:00
|
|
|
|
2022-06-03 18:37:27 +02:00
|
|
|
[target.'cfg(windows)'.dependencies.windows]
|
2023-07-18 15:36:54 +02:00
|
|
|
features = [
|
|
|
|
"Win32_Foundation",
|
|
|
|
"Win32_Storage_FileSystem",
|
Improve `registry value` return types (#10806)
r? @fdncred
Last one, I hope. At least short of completely redesigning `registry
query`'s interface. (Which I wouldn't implement without asking around
first.)
# Description
User-Facing Changes has the general overview. Inline comments provide a
lot of justification on specific choices. Most of the type conversions
should be reasonably noncontroversial, but expanding `REG_EXPAND_SZ`
needs some justification. First, an example of the behavior there:
```shell
> # release nushell:
> version | select version commit_hash | to md --pretty
| version | commit_hash |
| ------- | ---------------------------------------- |
| 0.85.0 | a6f62e05ae5b4e9ba4027fbfffd21025a898783e |
> registry query --hkcu Environment TEMP | get value
%USERPROFILE%\AppData\Local\Temp
> # with this patch:
> version | select version commit_hash | to md --pretty
| version | commit_hash |
| ------- | ---------------------------------------- |
| 0.86.1 | 0c5a4c991f1a77bcbe5a86bc8f4469ecf1218fe9 |
> registry query --hkcu Environment TEMP | get value
C:\Users\CAD\AppData\Local\Temp
> # Microsoft CLI tooling behavior:
> ^pwsh -c `(Get-ItemProperty HKCU:\Environment).TEMP`
C:\Users\CAD\AppData\Local\Temp
> ^reg query HKCU\Environment /v TEMP
HKEY_CURRENT_USER\Environment
TEMP REG_EXPAND_SZ %USERPROFILE%\AppData\Local\Temp
```
As noted in the inline comments, I'm arguing that it makes more sense to
eagerly expand the %EnvironmentString% placeholders, as none of
Nushell's path functionality will interpret these placeholders. This
makes the behavior of `registry query` match the behavior of pwsh's
`Get-ItemProperty` registry access, and means that paths (the most
common use of `REG_EXPAND_SZ`) are actually usable.
This does *not* break nu_script's
[`update-path`](https://github.com/nushell/nu_scripts/blob/main/sourced/update-path.nu);
it will just be slightly inefficient as it will not find any
`%Placeholder%`s to manually expand anymore. But also, note that
`update-path` is currently *wrong*, as a path including
`%LocalAppData%Low` is perfectly valid and sometimes used (to go to
`Appdata\LocalLow`); expansion isn't done solely on a path segment
basis, as is implemented by `update-path`.
I believe that the type conversions implemented by this patch are
essentially always desired. But if we want to keep `registry query`
"pure", we could easily introduce a `registry get`[^get] which does the
more complete interpretation of registry types, and leave `registry
query` alone as doing the bare minimum. Or we could teach `path expand`
to do `ExpandEnvironmentStringsW`. But REG_EXPAND_SZ being the odd one
out of not getting its registry type semantics decoded by `registry
query` seems wrong.
[^get]: This is the potential redesign I alluded to at the top. One
potential change could be to make `registry get Environment` produce
`record<Path: string, TEMP: string, TMP: string>` instead of `registry
query`'s `table<name: string, value: string, type: string>`, the idea
being to make it feel as native as possible. We could even translate
between Nu's cell-path and registry paths -- cell paths with spaces do
actually work, if a bit awkwardly -- or even introduce lazy records so
the registry can be traversed with normal data manipulation ... but that
all seems a bit much.
# User-Facing Changes
- `registry query`'s produced `value` has changed. Specifically:
- ❗ Rows `where type == REG_EXPAND_SZ` now expand `%EnvironmentVarable%`
placeholders for you. For example, `registry query --hkcu Environment
TEMP | get value` returns `C:\Users\CAD\AppData\Local\Temp` instead of
`%USERPROFILE%\AppData\Local\Temp`.
- You can restore the old behavior and preserve the placeholders by
passing a new `--no-expand` switch.
- Rows `where type == REG_MULTI_SZ` now provide a `list<string>` value.
They previously had that same list, but `| str join "\n"`.
- Rows `where type == REG_DWORD_BIG_ENDIAN` now provide the correct
numeric value instead of a byte-swapped value.
- Rows `where type == REG_QWORD` now provide the correct numeric
value[^sign] instead of the value modulo 2<sup>32</sup>.
- Rows `where type == REG_LINK` now provide a string value of the link
target registry path instead of an internal debug string representation.
(This should never be visible, as links should be transparently
followed.)
- Rows `where type =~ RESOURCE` now provide a binary value instead of an
internal debug string representation.
[^sign]: Nu's `int` is a signed 64-bit integer. As such, values >=
2<sup>63</sup> will be reported as their negative two's compliment
value. This might sometimes be the correct interpretation -- the
registry does not distinguish between signed and unsigned integer values
-- but regedit and pwsh display all values as unsigned.
2023-10-23 14:21:27 +02:00
|
|
|
"Win32_System_Environment",
|
2023-07-18 15:36:54 +02:00
|
|
|
"Win32_System_SystemServices",
|
|
|
|
"Win32_Security",
|
2023-08-23 22:23:27 +02:00
|
|
|
"Win32_System_Threading",
|
2023-07-18 15:36:54 +02:00
|
|
|
]
|
2024-03-24 00:46:02 +01:00
|
|
|
workspace = true
|
2022-06-03 18:37:27 +02:00
|
|
|
|
2021-10-10 06:13:15 +02:00
|
|
|
[features]
|
2021-11-02 21:56:00 +01:00
|
|
|
plugin = ["nu-parser/plugin"]
|
2023-06-14 23:12:55 +02:00
|
|
|
sqlite = ["rusqlite"]
|
2023-02-11 19:59:11 +01:00
|
|
|
trash-support = ["trash"]
|
|
|
|
which-support = ["which"]
|
2021-01-12 05:59:53 +01:00
|
|
|
|
|
|
|
[dev-dependencies]
|
2024-04-12 15:00:43 +02:00
|
|
|
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.92.3" }
|
|
|
|
nu-test-support = { path = "../nu-test-support", version = "0.92.3" }
|
2023-06-14 23:12:55 +02:00
|
|
|
|
2024-03-24 00:46:02 +01:00
|
|
|
dirs-next = { workspace = true }
|
|
|
|
mockito = { workspace = true, default-features = false }
|
|
|
|
quickcheck = { workspace = true }
|
|
|
|
quickcheck_macros = { workspace = true }
|
2024-03-07 23:40:31 +01:00
|
|
|
rstest = { workspace = true, default-features = false }
|
2024-04-26 13:23:16 +02:00
|
|
|
pretty_assertions = { workspace = true }
|