nushell/crates/nu-command/Cargo.toml

149 lines
5.3 KiB
TOML
Raw Normal View History

[package]
authors = ["The Nushell Project Developers"]
description = "Nushell's built-in commands"
edition = "2021"
license = "MIT"
name = "nu-command"
add a new inspect command for more debugging (#8028) # Description The purpose of this command is to help to debug pipelines. It works by allowing you to inject the `inspect` command into a pipeline at any point. Then it shows you what the input description is and what the input values are that are passed into `inspect`. With each step it prints this information out while also passing the value information on to the next step in the pipeline. ![image](https://user-images.githubusercontent.com/343840/218154064-e107859b-d0da-41c6-8e34-2d717639b81c.png) This command is kind of a "hack job" because it clones maybe too much and I had to get creative in order to output two different tables. I'm sure there are many ways this can be improved or combined into other commands but I wanted to start here. Note that the `inspect` output is written to stderr and the normal nushell output is written to stdout. If we were to output both to stdout, nushell would get confused. # User-Facing Changes # 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 -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # 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-02-11 19:59:11 +01:00
repository = "https://github.com/nushell/nushell/tree/main/crates/nu-command"
version = "0.93.0"
2021-09-02 03:29:43 +02:00
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
bench = false
2021-09-02 03:29:43 +02:00
[dependencies]
nu-cmd-base = { path = "../nu-cmd-base", version = "0.93.0" }
nu-color-config = { path = "../nu-color-config", version = "0.93.0" }
nu-engine = { path = "../nu-engine", version = "0.93.0" }
nu-glob = { path = "../nu-glob", version = "0.93.0" }
nu-json = { path = "../nu-json", version = "0.93.0" }
nu-parser = { path = "../nu-parser", version = "0.93.0" }
nu-path = { path = "../nu-path", version = "0.93.0" }
nu-pretty-hex = { path = "../nu-pretty-hex", version = "0.93.0" }
nu-protocol = { path = "../nu-protocol", version = "0.93.0" }
nu-system = { path = "../nu-system", version = "0.93.0" }
nu-table = { path = "../nu-table", version = "0.93.0" }
nu-term-grid = { path = "../nu-term-grid", version = "0.93.0" }
nu-utils = { path = "../nu-utils", version = "0.93.0" }
nu-ansi-term = { workspace = true }
nuon = { path = "../nuon", version = "0.93.0" }
2023-03-14 19:46:42 +01:00
alphanumeric-sort = { workspace = true }
base64 = { workspace = true }
bracoxide = { workspace = true }
brotli = { workspace = true }
byteorder = { workspace = true }
bytesize = { workspace = true }
calamine = { workspace = true, features = ["dates"] }
chardetng = { workspace = true }
chrono = { workspace = true, features = ["std", "unstable-locales", "clock"], default-features = false }
chrono-humanize = { workspace = true }
chrono-tz = { workspace = true }
crossterm = { workspace = true }
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 }
fancy-regex = { workspace = true }
filesize = { workspace = true }
filetime = { workspace = true }
fs_extra = { workspace = true }
human-date-parser = { workspace = true }
indexmap = { workspace = true }
indicatif = { workspace = true }
itertools = { workspace = true }
log = { workspace = true }
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 }
once_cell = { workspace = true }
open = { workspace = true }
os_pipe = { workspace = true }
pathdiff = { workspace = true }
percent-encoding = { workspace = true }
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 }
rmp = { workspace = true }
same-file = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, features = ["preserve_order"] }
serde_urlencoded = { workspace = true }
serde_yaml = { workspace = true }
sha2 = { workspace = true }
sysinfo = { workspace = true }
tabled = { workspace = true, features = ["color"], default-features = false }
terminal_size = { workspace = true }
titlecase = { workspace = true }
toml = { workspace = true }
unicode-segmentation = { workspace = true }
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 }
Initial implementation for uutils uname (#11684) Hi, This PR aims at implementing the first iteration for `uname` using `uutils`. Couple of things: * Currently my [PR](https://github.com/uutils/coreutils/pull/5921) to make the required changes is pending in `uutils` repo. * I guess the number of flags has to be investigated. Still the tests cover all of them. <!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - [X] `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - [X] `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - [X] `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)) - [X] `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. --> --------- Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2024-03-25 22:51:50 +01:00
uu_uname = { workspace = true }
uu_whoami = { workspace = true }
uuid = { workspace = true, features = ["v4"] }
v_htmlescape = { workspace = true }
wax = { workspace = true }
which = { workspace = true, optional = true }
unicode-width = { workspace = true }
[target.'cfg(windows)'.dependencies]
winreg = { workspace = true }
Adjust permissions using `umask` in `mkdir` (#12207) <!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> With this change, `mkdir` mirrors coreutils works. Closes #12161 I referred to the implementation of `mkdir` in uutils/coreutils. I add `uucore` required for implementation to dependencies. Since `uucore` is already included in dependencies of `uu_mkdir`, I don't think there will be any additional dependencies. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> - Directories are created according to `umask` except for Windows. # 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 > ``` --> I add `mkdir` test considering permissions. The test assumes that the default `umask` is `022`. # 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. -->
2024-03-14 22:43:42 +01:00
[target.'cfg(not(windows))'.dependencies]
uucore = { workspace = true, features = ["mode"] }
Adjust permissions using `umask` in `mkdir` (#12207) <!-- if this PR closes one or more issues, you can automatically link the PR with them by using one of the [*linking keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), e.g. - this PR should close #xxxx - fixes #xxxx you can also mention related issues, PRs or discussions! --> # Description <!-- Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes. Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience. --> With this change, `mkdir` mirrors coreutils works. Closes #12161 I referred to the implementation of `mkdir` in uutils/coreutils. I add `uucore` required for implementation to dependencies. Since `uucore` is already included in dependencies of `uu_mkdir`, I don't think there will be any additional dependencies. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> - Directories are created according to `umask` except for Windows. # 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 > ``` --> I add `mkdir` test considering permissions. The test assumes that the default `umask` is `022`. # 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. -->
2024-03-14 22:43:42 +01:00
[target.'cfg(unix)'.dependencies]
umask = { workspace = true }
nix = { workspace = true, default-features = false, features = ["user", "resource", "pthread"] }
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]
procfs = { workspace = true }
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies.trash]
optional = true
workspace = true
[target.'cfg(windows)'.dependencies.windows]
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",
"Win32_System_SystemServices",
"Win32_Security",
"Win32_System_Threading",
]
workspace = true
[features]
2021-11-02 21:56:00 +01:00
plugin = ["nu-parser/plugin"]
2023-06-14 23:12:55 +02:00
sqlite = ["rusqlite"]
add a new inspect command for more debugging (#8028) # Description The purpose of this command is to help to debug pipelines. It works by allowing you to inject the `inspect` command into a pipeline at any point. Then it shows you what the input description is and what the input values are that are passed into `inspect`. With each step it prints this information out while also passing the value information on to the next step in the pipeline. ![image](https://user-images.githubusercontent.com/343840/218154064-e107859b-d0da-41c6-8e34-2d717639b81c.png) This command is kind of a "hack job" because it clones maybe too much and I had to get creative in order to output two different tables. I'm sure there are many ways this can be improved or combined into other commands but I wanted to start here. Note that the `inspect` output is written to stderr and the normal nushell output is written to stdout. If we were to output both to stdout, nushell would get confused. # User-Facing Changes # 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 -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # 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-02-11 19:59:11 +01:00
trash-support = ["trash"]
which-support = ["which"]
[dev-dependencies]
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.93.0" }
nu-test-support = { path = "../nu-test-support", version = "0.93.0" }
2023-06-14 23:12:55 +02:00
dirs-next = { workspace = true }
mockito = { workspace = true, default-features = false }
quickcheck = { workspace = true }
quickcheck_macros = { workspace = true }
rstest = { workspace = true, default-features = false }
pretty_assertions = { workspace = true }