mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
69a73dfe1b722c87f7aefc54f40ff347e87932e5
10129 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
d289c773d0 |
Change --max-time arg for http commands to use Duration type (#14237)
# Description Fixes #14222. The ability to set duration unit for `--max-time` when using the `http` command util. Signed-off-by: Alex Johnson <alex.kattathra.johnson@gmail.com> |
|||
a935e0720f |
no deref in touch (#14214)
<!-- 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. --> Adds --no-deref flag to `touch`. Nice and backwards compatible, and I get to touch symlinks. I still don't get to set their dates directly, but maybe that'll come with utouch. Some sadness in the implementation, since `set_symlink_file_times` doesn't take Option values and we call it twice with the old "read" values from reference (or now, if missing). This shouldn't be a big concern since `touch` already did two calls if you set both mtime and atime. Also, `--no-deref` applies both to the reference file, and to the target file. No splitting them up, because that's silly. Can always bikeshed. I nicked `--no-deref` from the uutils flag, and made the short flag `-d` because it obviously can't be `-h`. I thought of `-S` like in `glob`, for the "negative/filter out" uppercase short letters. Ultimately I don't think it matters much. Should fix #14212 since it's not really tied to uutils, besides the comment about setting a `datetime` value directly. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> New flag. # 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 toolkit.nu; toolkit test stdlib"` 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 > ``` --> Maybe. # 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. --> |
|||
1c3ff179bc |
Improve CellPath display output (#14197)
<!-- 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. --> Fixes: #13362 This PR fixes the `Display` impl for `CellPath`, as laid out in #13362 and #14090: ```nushell > $.0."0" $.0."0" > $."foo.bar".baz $."foo.bar".baz ``` # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> Cell-paths are now printed using the same `$.` notation that is used to create them, and ambiguous column names are properly quoted. # 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 toolkit.nu; toolkit test stdlib"` 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. --> |
|||
ccab3d6b6e |
Improve comment wording in run_external.rs (#14230)
verb 'setup' -> 'set up' setup as verb [is a misspelling of set up](https://en.wiktionary.org/wiki/setup#Verb) * [verb: set up](https://en.wiktionary.org/wiki/set_up) * [noun: setup](https://en.wiktionary.org/wiki/setup) *I split this from #14229 typo corrections because 'setup' is not as clear-cut wrong. Having read the dictionary pages (linked) I'm even more confident in this change being correct rather than only subjectively better.* Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com> |
|||
3e39fae6e1 | Fix comment typos in run_external.rs (#14229) | |||
d575fd1c3a | Tests for new Alpine and Debian image builds (#14225) | |||
0a2fb137af |
don't run subcommand if it's surrounded with backtick quote (#14210)
# Description Fixes: #14202 After looking into the issue, I think #13910 it's not good to cut the span if it's in external argument. This pr is somehow revert the change, and fix https://github.com/nushell/nushell/issues/13431 in another way. It introduce a new state named `State::BackTickQuote`, so if an external arg include backtick quote, it enters the state, so backtick quote won't be the body of a string. # User-Facing Changes ### Before ```nushell > ^echo `(echo aa)` aa > ^echo `"aa"` # maybe it's not right to remove the inner quote. aa ``` ### After ```nushell > ^echo `(echo aa)` (echo aa) > ^echo `"aa"` # inner quote is keeped if there are backtick quote outside. "aa" ``` # Tests + Formatting Added 3 tests. |
|||
4907575d3d |
Bump chrono-tz from 0.8.6 to 0.10.0 (#14205)
Bumps [chrono-tz](https://github.com/chronotope/chrono-tz) from 0.8.6 to 0.10.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/chronotope/chrono-tz/releases">chrono-tz's releases</a>.</em></p> <blockquote> <h2>chrono-tz v0.10.0: 2024b</h2> <p><strong>TZDB</strong> version 2024b (2024-09-05).</p> <h2>Changes</h2> <ul> <li>Make <code>OffsetName::abbreviation</code> return an <code>Option</code>. This reflects that numeric values such as <code>+11</code> are no longer encoded in the upstream TZDB as abbreviations (<a href="https://redirect.github.com/chronotope/chrono-tz/issues/185">#185</a>).</li> </ul> <h2>TZDB 2024b</h2> <blockquote> <p>The 2024b release of the tz code and data is available.</p> <p>This release is prompted by the accumulated weight of many non-urgent changes to both code and data. It changes one timestamp abbreviation, for the long-obsolete System V setting TZ='MET'; see below. Otherwise, the timestamps affected by this release all predate April 2008, so you can skip this release if your application uses only tzdata and does not use older timestamps.</p> <p>This release contains the following changes:</p> <h3>Briefly:</h3> <p>Improve historical data for Mexico, Mongolia, and Portugal. System V names are now obsolescent. The main data form now uses %z. The code now conforms to RFC 8536 for early timestamps. Support POSIX.1-2024, which removes asctime_r and ctime_r. Assume POSIX.2-1992 or later for shell scripts. SUPPORT_C89 now defaults to 1.</p> <h3>Changes to past timestamps</h3> <p>Asia/Choibalsan is now an alias for Asia/Ulaanbaatar rather than being a separate Zone with differing behavior before April 2008. This seems better given our wildly conflicting information about Mongolia's time zone history. (Thanks to Heitor David Pinto.)</p> <p>Historical transitions for Mexico have been updated based on official Mexican decrees. The affected timestamps occur during the years 1921-1927, 1931, 1945, 1949-1970, and 1981-1997. The affected zones are America/Bahia_Banderas, America/Cancun, America/Chihuahua, America/Ciudad_Juarez, America/Hermosillo, America/Mazatlan, America/Merida, America/Mexico_City, America/Monterrey, America/Ojinaga, and America/Tijuana. (Thanks to Heitor David Pinto.)</p> <p>Historical transitions for Portugal, represented by Europe/Lisbon, Atlantic/Azores, and Atlantic/Madeira, have been updated based on a close reading of old Portuguese legislation, replacing previous data mainly originating from Whitman and Shanks & Pottenger. These changes affect a few transitions in 1917-1921, 1924, and 1940 throughout these regions by a few hours or days, and various timestamps between 1977 and 1993 depending on the region. In particular, the Azores and Madeira did not observe DST from 1977 to 1981. Additionally, the adoption of standard zonal time in former Portuguese colonies have been adjusted: Africa/Maputo in 1909, and Asia/Dili by 22 minutes at the start of 1912. (Thanks to Tim Parenti.)</p> <h3>Changes to past tm_isdst flags</h3> <p>The period from 1966-04-03 through 1966-10-02 in Portugal is now modeled as DST, to more closely reflect how contemporaneous changes in law entered into force.</p> <h3>Changes to data</h3> <p>Names present only for compatibility with UNIX System V (last released in the 1990s) have been moved to 'backward'. These names, which for post-1970 timestamps mostly just duplicate data of geographical names, were confusing downstream uses. Names moved to 'backward' are now links to geographical names. This affects behavior for TZ='EET' for some pre-1981 timestamps, for TZ='CET' for some pre-1947 timestamps, and for TZ='WET' for some pre-1996 timestamps. Also, TZ='MET' now behaves like TZ='CET' and so uses the abbreviation "CET" rather than "MET". Those needing the previous TZDB behavior, which does not match any real-world clocks, can find the old entries in 'backzone'. (Problem reported by Justin Grant.)</p> <p>The main source files' time zone abbreviations now use %z, supported by zic since release 2015f and used in vanguard form since release 2022b. For example, America/Sao_Paulo now contains the zone continuation line "-3:00 Brazil %z", which is less error prone than the old "-3:00 Brazil -03/-02". This does not change the represented data: the generated TZif files are unchanged. Rearguard form still avoids %z, to support obsolescent parsers.</p> <p>Asia/Almaty has been removed from zonenow.tab as it now agrees with Asia/Tashkent for future timestamps, due to Kazakhstan's 2024-02-29 time zone change. Similarly, America/Scoresbysund has been removed, as it now agrees with America/Nuuk due to its 2024-03-31 time zone change.</p> </blockquote> <h2>chrono-tz v0.9.0: 2024a</h2> <p><strong>TZDB</strong> version <a href="https://mm.icann.org/pipermail/tz-announce/2024-February/000081.html">2024a</a> (2024-02-01).</p> <h2>Changes</h2> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
|||
4200df21d3 |
Add RELEASE_QUERY_API build arg for Dockerfiles (#14209)
<!-- 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. --> Add `RELEASE_QUERY_API` build arg for all Dockerfiles, with default value set to `https://api.github.com/repos/nushell/nushell/releases/latest`, So that we can build the nightly images with the same Dockerfile but a different `RELEASE_QUERY_API` build arg. A nightly image build with the new Dockerfile could be found here: https://github.com/orgs/nushell/packages/container/nushell/297473460?tag=nightly # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> The default behavior keep the same as before # 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. --> Those who want to build a docker image with the nushell nightly release installed could run: ```nu let queryApi = http get https://api.github.com/repos/nushell/nightly/releases | sort-by -r created_at | get 0.url docker buildx build --build-arg $'RELEASE_QUERY_API=($queryApi)' ... ``` |
|||
e0bb5a2bd2 |
Allow using function keys F21-F35 for keybindings (#14201)
I feel like the limitations on what can be bound are too strict. if an app _does_ support the Kitty keyboard protocol (Neovim, Reedline), I can map the function keys (F27-F35 as listed below). In Reedline everything works perfectly. The issue is for some reason we limit the keys that can be bound in Nushell, so I am unable to do that. |
|||
a6c2c685bc |
Bump trash from 5.1.1 to 5.2.0 (#14206)
Bumps [trash](https://github.com/ArturKovacs/trash) from 5.1.1 to 5.2.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/ArturKovacs/trash/releases">trash's releases</a>.</em></p> <blockquote> <h2>v5.2.0</h2> <h3>New Features</h3> <ul> <li> <p>Short circuiting check for empty trash <code>is_empty()</code> is a short circuiting function that checks if the trash is empty on Freedesktop compatible systems and Windows.</p> <p>The main purpose of <code>is_empty()</code> is to avoid evaluating the entire trash context when the caller is only interested in whether the trash is empty or not. This is especially useful for full trashes with many items.</p> </li> </ul> <h3>Commit Statistics</h3> <ul> <li>2 commits contributed to the release.</li> <li>56 days passed between releases.</li> <li>1 commit was understood as <a href="https://www.conventionalcommits.org">conventional</a>.</li> <li>0 issues like '(#ID)' were seen in commit messages</li> </ul> <h3>Commit Details</h3> <!-- raw HTML omitted --> <!-- raw HTML omitted --> <ul> <li><strong>Uncategorized</strong> <ul> <li>Merge pull request <a href="https://redirect.github.com/ArturKovacs/trash/issues/120">#120</a> from joshuamegnauth54/feat-short-circuiting-is-empty (0120bbe)</li> <li>Short circuiting check for empty trash (6d59fa9)</li> </ul> </li> </ul> <!-- raw HTML omitted --> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/Byron/trash-rs/blob/master/CHANGELOG.md">trash's changelog</a>.</em></p> <blockquote> <h2>5.2.0 (2024-10-26)</h2> <h3>New Features</h3> <ul> <li> <p><!-- raw HTML omitted --> Short circuiting check for empty trash <code>is_empty()</code> is a short circuiting function that checks if the trash is empty on Freedesktop compatible systems and Windows.</p> <p>The main purpose of <code>is_empty()</code> is to avoid evaluating the entire trash context when the caller is only interested in whether the trash is empty or not. This is especially useful for full trashes with many items.</p> </li> </ul> <h3>Commit Statistics</h3> <!-- raw HTML omitted --> <ul> <li>2 commits contributed to the release.</li> <li>56 days passed between releases.</li> <li>1 commit was understood as <a href="https://www.conventionalcommits.org">conventional</a>.</li> <li>0 issues like '(#ID)' were seen in commit messages</li> </ul> <h3>Commit Details</h3> <!-- raw HTML omitted --> <!-- raw HTML omitted --> <ul> <li><strong>Uncategorized</strong> <ul> <li>Merge pull request <a href="https://redirect.github.com/ArturKovacs/trash/issues/120">#120</a> from joshuamegnauth54/feat-short-circuiting-is-empty (<a href=" |
|||
1e2fa68db0 |
Bump fancy-regex from 0.13.0 to 0.14.0 (#14207)
Bumps [fancy-regex](https://github.com/fancy-regex/fancy-regex) from 0.13.0 to 0.14.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/fancy-regex/fancy-regex/releases">fancy-regex's releases</a>.</em></p> <blockquote> <h2>0.14.0</h2> <h3>Added</h3> <ul> <li>Add <code>split</code>, <code>splitn</code> methods to <code>Regex</code> to split a string into substrings (<a href="https://redirect.github.com/fancy-regex/fancy-regex/issues/140">#140</a>)</li> <li>Add <code>case_insensitive</code> method to <code>RegexBuilder</code> to force case-insensitive mode (<a href="https://redirect.github.com/fancy-regex/fancy-regex/issues/132">#132</a>)</li> </ul> <h3>Changed</h3> <ul> <li>Bump bit-set dependency to 0.8 (<a href="https://redirect.github.com/fancy-regex/fancy-regex/issues/139">#139</a>)</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/fancy-regex/fancy-regex/blob/main/CHANGELOG.md">fancy-regex's changelog</a>.</em></p> <blockquote> <h2>[0.14.0] - 2024-10-24</h2> <h3>Added</h3> <ul> <li>Add <code>split</code>, <code>splitn</code> methods to <code>Regex</code> to split a string into substrings (<a href="https://redirect.github.com/fancy-regex/fancy-regex/issues/140">#140</a>)</li> <li>Add <code>case_insensitive</code> method to <code>RegexBuilder</code> to force case-insensitive mode (<a href="https://redirect.github.com/fancy-regex/fancy-regex/issues/132">#132</a>)</li> </ul> <h3>Changed</h3> <ul> <li>Bump bit-set dependency to 0.8 (<a href="https://redirect.github.com/fancy-regex/fancy-regex/issues/139">#139</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
|||
599f16f15c |
Bump unicase from 2.7.0 to 2.8.0 (#14208)
Bumps [unicase](https://github.com/seanmonstar/unicase) from 2.7.0 to 2.8.0. <details> <summary>Commits</summary> <ul> <li><a href=" |
|||
91da168251 |
Bump crate-ci/typos from 1.26.0 to 1.26.8 (#14203)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.26.0 to 1.26.8. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/crate-ci/typos/releases">crate-ci/typos's releases</a>.</em></p> <blockquote> <h2>v1.26.8</h2> <h2>[1.26.8] - 2024-10-24</h2> <h2>v1.26.3</h2> <h2>[1.26.3] - 2024-10-24</h2> <h3>Fixes</h3> <ul> <li>Accept <code>additionals</code></li> </ul> <h2>v1.26.2</h2> <h2>[1.26.2] - 2024-10-24</h2> <h3>Fixes</h3> <ul> <li>Accept <code>tesselate</code> variants</li> </ul> <h2>v1.26.1</h2> <h2>[1.26.1] - 2024-10-23</h2> <h3>Fixes</h3> <ul> <li>Respect <code>--force-exclude</code> for binary files</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/crate-ci/typos/blob/master/CHANGELOG.md">crate-ci/typos's changelog</a>.</em></p> <blockquote> <h2>[1.26.8] - 2024-10-24</h2> <h2>[1.26.7] - 2024-10-24</h2> <h2>[1.26.6] - 2024-10-24</h2> <h2>[1.26.5] - 2024-10-24</h2> <h2>[1.26.4] - 2024-10-24</h2> <h2>[1.26.3] - 2024-10-24</h2> <h3>Fixes</h3> <ul> <li>Accept <code>additionals</code></li> </ul> <h2>[1.26.2] - 2024-10-24</h2> <h3>Fixes</h3> <ul> <li>Accept <code>tesselate</code> variants</li> </ul> <h2>[1.26.1] - 2024-10-23</h2> <h3>Fixes</h3> <ul> <li>Respect <code>--force-exclude</code> for binary files</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
|||
e104bccfb9 |
Drop once_cell dependency (#14198)
This PR drops the `once_cell` dependency from all Nu crates, replacing uses of the [`Lazy`](https://docs.rs/once_cell/latest/once_cell/sync/struct.Lazy.html) type with its `std` equivalent, [`LazyLock`](https://doc.rust-lang.org/std/sync/struct.LazyLock.html). |
|||
74bd0e32cc |
ansi -l includes previews of attributes (e.g., bold, dimmed, blink, etc.) (#14196)
# Description A few simple changes: * Extends the range of previews to include the attributes - Bold, italic, underline, etc. * Also resets the colors before *every* preview. Previously we weren't doing this, so the "string" theme color was bleeding into a few previews (mostly, if not all, `bg` ones). Now the "default foreground" color is used for any preview without an explicit foreground color. * Moves the preview code into the `if use_ansi_coloring` block as a stupid-nitpick optimization. There's no reason to populate the previews when they are explicitly not shown with `use_ansi_coloring: false`. * Moves `reset` to the bottom of the attribute list so that it isn't previewed. This is a bit of a nitpick as well since internally we send the same code for both a `reset` and `attr_normal` (which is correct), but semantically a `reset` doesn't seem like a "previewable" thing, whereas "normal" text can be demonstrated with a preview. # User-Facing Changes `ansi -l` now shows additional previews # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A |
|||
03015ed33f |
Show ? for optional entries when displaying CellPath s (#14042)
<!-- 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. --> This PR makes the `Display` implementation for `CellPath` show a `?` suffix on every optional entry, which makes the output consistent with the language syntax. Before this PR, the printing of cell paths was confusing, e.g. `$.x` and `$.x?` were both printed as `x`. Now, the second one is printed as `x?`. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> The formatting of cell paths now matches the syntax used to create them, reducing confusion. # 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 toolkit.nu; toolkit test stdlib"` 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 > ``` --> All tests pass, including `stdlib` tests. # 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. --> |
|||
79ea70d4ec |
Fix quoting in to nuon and refactor quoting functions (#14180)
<!-- 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. --> This PR fixes the quoting and escaping of column names in `to nuon`. Before the PR, column names with quotes inside them would get quoted, but not escaped: ```nushell > { 'a"b': 2 } | to nuon { "a"b": 2 } > { 'a"b': 2 } | to nuon | from nuon Error: × error when loading nuon text ╭─[entry #1:1:27] 1 │ { "a\"b": 2 } | to nuon | from nuon · ────┬──── · ╰── could not load nuon text ╰──── Error: × error when parsing nuon text ╭─[entry #1:1:27] 1 │ { "a\"b": 2 } | to nuon | from nuon · ────┬──── · ╰── could not parse nuon text ╰──── Error: × error when parsing ╭──── 1 │ {"a"b": 2} · ┬ · ╰── Unexpected end of code. ╰──── > [['a"b']; [2] [3]] | to nuon [["a"b"]; [2], [3]] > [['a"b']; [2] [3]] | to nuon | from nuon Error: × error when loading nuon text ╭─[entry #1:1:32] 1 │ [['a"b']; [2] [3]] | to nuon | from nuon · ────┬──── · ╰── could not load nuon text ╰──── Error: × error when parsing nuon text ╭─[entry #1:1:32] 1 │ [['a"b']; [2] [3]] | to nuon | from nuon · ────┬──── · ╰── could not parse nuon text ╰──── Error: × error when parsing ╭──── 1 │ [["a"b"]; [2], [3]] · ┬ · ╰── Unexpected end of code. ╰──── ``` After this PR, the quote is escaped properly: ```nushell > { 'a"b': 2 } | to nuon { "a\"b": 2 } > { 'a"b': 2 } | to nuon | from nuon ╭─────┬───╮ │ a"b │ 2 │ ╰─────┴───╯ > [['a"b']; [2] [3]] | to nuon [["a\"b"]; [2], [3]] > [['a"b']; [2] [3]] | to nuon | from nuon ╭─────╮ │ a"b │ ├─────┤ │ 2 │ │ 3 │ ╰─────╯ ``` The cause of the issue was that `to nuon` simply wrapped column names in `'"'` instead of calling `escape_quote_string`. As part of this change, I also moved the functions related to quoting (`needs_quoting` and `escape_quote_string`) into `nu-utils`, since previously they were defined in very ad-hoc places (and, in the case of `escape_quote_string`, it was defined multiple times with the same body!). # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> `to nuon` now properly escapes quotes in column names. # 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 toolkit.nu; toolkit test stdlib"` 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 > ``` --> All tests pass, including workspace and stdlib tests. # 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. --> |
|||
3ec76af96e |
Add Debian Dockerfile (#14193)
# Description Add Dockerfile for Debian/Ubuntu images. Related to #14171 and PR #14191 This is largely similar to the Alpine version, however there are some minor differences: - I've specially added Debian Bookworm here to provide some stability when new major versions are released. We can bump the (LTS only perhaps) versions supported as needed. - I moved the creation of the nushell user until later to avoid a warning about the nu binary not (yet) being available. - Debian doesn't come with wget or curl. I've added wget to be similar to Alpine. I tried creating a multi-layer version to avoid installing wget (reduced attack surface) but the image was bigger due to the extra layer, so didn't seem worth being different. I can transfer the relevant changes to the Alpine image if we want to keep them easily diffable? # User-Facing Changes While this provides a Debian image by default. An Ubuntu image can be created from this by changing to `FROM ubuntu:noble`. We could later supply that as an optional argument from the build workflow to be able to build different distros and supported versions. # Tests + Formatting The images produced for Debian/Ubuntu are ~75Mb bigger as listed in `docker images`: ``` REPOSITORY TAG IMAGE ID CREATED SIZE nu-alpine latest 71c0216eddd9 44 years ago 167MB nu-debian latest cce3d91fc77c 44 years ago 243MB nu-ubuntu latest ce90497da806 44 years ago 240MB ``` I've tested a few nu commands, including polars. It seems to work okay. It makes sense to add some container-based tests once the workflows are available. I'll probably pick that up later when @hustcer has completed the migration of his workflows. Perhaps invoking a nushell-based test suite if one is available. The toolkit seems to rely on cargo and the source being available, which of course won't work here. |
|||
b8efd2a347 |
ansi name for clear-scrollback code (#14184)
Related to #14181 # Description Our understanding of `ESC[3J` has apparently been wrong. And I say "our" because I posted a [Super User answer](https://superuser.com/a/1738611/1210833) a couple of years ago with the same misconception (now fixed). In addition, the [crossterm crate doc](https://docs.rs/crossterm/latest/crossterm/terminal/enum.ClearType.html) is wrong on the topic. `ESC[3J` doesn't clear the screen plus the scrollback; it *only* clears the scrollback. Reference the official [Xterm Control Sequences doc](https://www.xfree86.org/4.8.0/ctlseqs.html). > CSI P s J > > Erase in Display (ED) > > P s = 0 → Erase Below (default) > P s = 1 → Erase Above > P s = 2 → Erase All > P s = 3 → Erase Saved Lines (xterm) This also means that: ```nu $"(ansi clear_entire_screen_plus_buffer)" ``` ... doesn't. This PR updates it to `ansi clear_scrollback_buffer` (short-code remains the same). # User-Facing Changes Breaking-change: `ansi clear_entire_screen_plus_buffer` is renamed `ansi clear_scrollback_buffer` # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting Self-documenting command via `ansi -l` |
|||
9083157baa |
support table literal syntax in join right-table argument (#14190)
# Description Makes `join` `right-table` support table literal notation instead of parsing the column list (treated as empty data): ```diff [{a: 1}] | join [[a]; [1]] a | to nuon -[] +[[a]; [1]] ``` Fixes #13537, fixes #14134 |
|||
6cdc9e3b77 |
Fix LSP non-ascii characters offset issues. (#14002)
<!-- 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! --> This PR is supposed to fix #13582, #11522, as well as related goto definition/reference issues (wrong position if non ascii characters ahead). # 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. --> <img width="411" alt="image" src="https://github.com/user-attachments/assets/9a81953c-81b2-490d-a842-14ccaefd6972"> Changes: 1. span/completion should use byte offset instead of character index 2. lsp Postions related ops in Ropey remain to use character index # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> Should be none, tested in neovim with config: ```lua require("lspconfig").nushell.setup({ cmd = { "nu", "-I", vim.fn.getcwd(), "--no-config-file", "--lsp", }, filetypes = { "nu" }, }) ``` # 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 toolkit.nu; toolkit test stdlib"` 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 > ``` --> tests::complete_command_with_utf_line parameters fixed to align with true lsp requests (in character index, not byte). As for the issue_11522.nu, manually tested: <img width="520" alt="image" src="https://github.com/user-attachments/assets/45496ba8-5a2d-4998-9190-d7bde31ee72c"> # 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. --> |
|||
f8d4adfb7a |
Add the history import command (again) (#14083)
# Description This is mainly https://github.com/nushell/nushell/pull/13450 (which got reverted). Additionally: - always clear IDs on import, disallow specifying IDs when piping - added extra tests - create backup of the history # User-Facing Changes New command: `history import` # Tests + Formatting Added mostly integration tests and a few smaller unit tests. |
|||
719d9aa83c |
provide a common implementation for query string conversions in url join and url build-query (#14173)
Addresses one of the points in #14162 # Description Factors out part of the `url::build_query::to_url` function into a separate function `url::query::record_to_qs()`, which is then used in both `url::build_query` and `url::join`. # User-Facing Changes Like with `url build-query` (after #14073), `url join` will allow list values in `params` and behavior of two commands will be same. ```nushell > {a: ["one", "two"], b: "three"} | url build-query "a=one&a=two&b=three" > {scheme: "http", host: "host", params: {a: ["one", "two"], b: "three"}} | url join "http://host?a=one&a=two&b=three" ``` # Tests + Formatting Added an example to `url join` for the new behavior. |
|||
9ebaa737aa |
feat: stor insert accepts lists (#14175)
Closes #11433 # Description This feature implements passing a list into `stor insert` through pipeline. ```bash stor create --table-name nudb --columns {bool1: bool, int1: int, float1: float} ; [[bool1 int1 float1]; [true 5 1.1], [false 8 3.14]] | stor insert --table-name nudb ``` ```bash stor create --table-name files --columns {name: str, type: str, size: int, modified: datetime} ; ls | stor insert --table-name files ``` # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` |
|||
88b0982dac |
allow oem code pages to be used to decode text (#14187)
# Description This PR allows oem code pages to be used in decoding by specifying the code page number. ## Before  ## After (umlauts)  closes https://github.com/nushell/nushell/issues/14168 I abstracted the decoding a bit. Here are my function comments on how/why. ```rust // Since we have two different decoding mechanisms, we allow oem_cp to be // specified by only a number like `open file | decode 850`. If this decode // parameter parses as a usize then we assume it was intentional and use oem_cp // crate. Otherwise, if it doesn't parse as a usize, we assume it was a string // and use the encoding_rs crate to try and decode it. ``` # 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: - `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 toolkit.nu; toolkit test stdlib"` 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. --> |
|||
8c2e12ad79 |
Update the dockerfile for alpine image (#14191)
<!-- 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. --> Update the dockerfile for alpine image, related https://github.com/nushell/nushell/issues/14171 : 1. Add armv7 arch support 2. Add more opencontainers labels, see: https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> - Nushell docker images will be provided for each official release - There will be a `nushell:nightly` tag for the latest nightly release # After Submitting 1. The workflow that build the images will be provided in [nushell/nightly](https://github.com/nushell/nightly) repo later 2. Alpine image will be provided as the default, we may also add Debian images later |
|||
2c31b3db07 |
Ensure default config files end with a new line (#14192)
# Description This allows users to immediately add new lines to the configuration in the usual way. |
|||
eedf833b6f |
Send both 2J and 3J on clear (#14181)
Fixes #14176 # Description Since the Linux `/usr/bin/clear` binary doesn't exhibit the issue in #14176, I checked to see what ANSI escapes it is emitting: ```nu nu -c '^clear; "111\n222\n333"' | less # or bash -c 'clear -x; echo -e "111\n222\n333"' | less ``` Both show the same thing: ``` ESC[HESC[2JESC[3J111 222 333 (END) ``` This is the equivalent of: ```nu $"(ansi home)(ansi clear_entire_screen)(ansi clear_entire_screen_plus_buffer)111\n222\n333" ``` However, our internal `clear` is sending only the Home and 3J. While this *should*, in theory, work, it's (a) clear that it doesn't, and (b) `/usr/bin/clear` seemingly knows this and already has the solution (or at least workaround). From looking at the `ncurses` source, it appears it is getting this information from the terminal capabilities. That said, support for `2J` and `3J` is fairly universal, and it's what we send in `clear` and `clear --keep-scrollback` anyway, so there's no harm AFAICT in sending both like `/usr/bin/clear` does. Also tested and fixes the issue on Windows. Note that PowerShell `Clear-Host` also did not have the issue. Side-note: It's interesting that on Tmux, which doesn't support 2J and 3J, that `/usr/bin/clear` knows this and doesn't send those codes, sending just an escape-[J instead. However, Nushell's `clear`, of course, isn't checking terminal capabilities, and is continuing to send the unsupported codes. Fortunately this doesn't appear to cause any issues on Tmux. # User-Facing Changes None, AFAICT - Bugfix only. # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A |
|||
69d81cc065 |
add command_type to help (#14165)
# Description This PR adds an indicator when listing subcommands. That indicator tells whether the command is a plugin, alias, or custom_command.  I changed some of the API to make this work a little easier, namely `get_signatures()` is now `get_signatures_and_declids()`. It was used in only one other place (run-external), so I thought it was fine to change it. There is a long-standing issue with aliases where they reference the command name instead of the alias name. This PR doesn't fix that bug. Example. ```nushell ❯ alias "str fill" = str wrap ``` ```nushell ❯ str ... other stuff Subcommands: str wrap (alias) - Alias for `str wrap` str wrap (plugin) - Wrap text passed into pipeline. ``` # User-Facing Changes Slightly different output of subcommands. |
|||
af9c31152a |
Add metadata on open --raw with bytestreams (#14141)
# Description This PR closes #14137 and allows the display hook to be set on byte streams. So, with a hook like this below. ```nushell display_output: { metadata access {|meta| match $meta.content_type? { "application/x-nuscript" | "application/x-nuon" | "text/x-nushell" => { nu-highlight }, "application/json" => { ^bat --language=json --color=always --style=plain --paging=never }, _ => {}, } } | table } ``` You could type `open toolkit.nu` and the text of toolkit.nu would be highlighted by nu-highlight. This PR also changes the way content-type is assigned with `open`. Previously it would only assign it if `--raw` was specified. Lastly, it changes the `is_external()` function to only say `ByteStreamSource::Child`'s are external instead of both Child and `ByteStreamSource::File`. Again, this was to allow the hook to function properly. I'm not sure what negative ramifications changing `is_external()` could have, but there may be some? # 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: - `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 toolkit.nu; toolkit test stdlib"` 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. --> |
|||
abb6fca5e3 |
make adding newlines with to text more consistent and opt-out-able (#14158)
# Description This PR tries to make `to text` more consistent with how it adds newlines and also gives you an opt-out --no-newline option.  I wasn't sure how to change the `PipelineData::ByteStream` match arm. I figure something needs to be done there but I'm not sure how to do it. # User-Facing Changes newlines are more consistent. # 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 toolkit.nu; toolkit test stdlib"` 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. --> |
|||
3ec1c40320 |
Introduce footer_inheritance option (#14070)
```nu $env.config.table.footer_inheritance = true ``` close #14060 |
|||
619211c1bf |
Bump brotli to 6.0.0 (#14161)
This deduplicates our dependency on `brotli` |
|||
3a685049da |
add name to $env.config.keybindings (#14159)
# Description This PR adds the `name` column back to keybindings. This may be considered a hack since the reedline keybinding has no spot for name, but it seems to work. |
|||
ae54d05930 |
Upgrade to polars 0.43 (#14148)
Upgrades the polars plugin to polars version 0.43 |
|||
e7c4597ad0 |
Bump uuid from 1.10.0 to 1.11.0 (#14155)
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.10.0 to 1.11.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/uuid-rs/uuid/releases">uuid's releases</a>.</em></p> <blockquote> <h2>1.11.0</h2> <h2>What's Changed</h2> <ul> <li>Upgrade zerocopy to 0.8 by <a href="https://github.com/yotamofek"><code>@yotamofek</code></a> in <a href="https://redirect.github.com/uuid-rs/uuid/pull/771">uuid-rs/uuid#771</a></li> <li>Prepare for 1.11.0 release by <a href="https://github.com/KodrAus"><code>@KodrAus</code></a> in <a href="https://redirect.github.com/uuid-rs/uuid/pull/772">uuid-rs/uuid#772</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/yotamofek"><code>@yotamofek</code></a> made their first contribution in <a href="https://redirect.github.com/uuid-rs/uuid/pull/771">uuid-rs/uuid#771</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/uuid-rs/uuid/compare/1.10.0...1.11.0">https://github.com/uuid-rs/uuid/compare/1.10.0...1.11.0</a></p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
|||
09c9495015 |
Bump bytes from 1.7.1 to 1.8.0 (#14156)
Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.7.1 to 1.8.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/tokio-rs/bytes/releases">bytes's releases</a>.</em></p> <blockquote> <h2>Bytes 1.8.0</h2> <h1>1.8.0 (October 21, 2024)</h1> <ul> <li>Guarantee address in <code>split_off</code>/<code>split_to</code> for empty slices (<a href="https://redirect.github.com/tokio-rs/bytes/issues/740">#740</a>)</li> </ul> <h2>Bytes 1.7.2</h2> <h1>1.7.2 (September 17, 2024)</h1> <h3>Fixed</h3> <ul> <li>Fix default impl of <code>Buf::{get_int, get_int_le}</code> (<a href="https://redirect.github.com/tokio-rs/bytes/issues/732">#732</a>)</li> </ul> <h3>Documented</h3> <ul> <li>Fix double spaces in comments and doc comments (<a href="https://redirect.github.com/tokio-rs/bytes/issues/731">#731</a>)</li> </ul> <h3>Internal changes</h3> <ul> <li>Ensure BytesMut::advance reduces capacity (<a href="https://redirect.github.com/tokio-rs/bytes/issues/728">#728</a>)</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md">bytes's changelog</a>.</em></p> <blockquote> <h1>1.8.0 (October 21, 2024)</h1> <ul> <li>Guarantee address in <code>split_off</code>/<code>split_to</code> for empty slices (<a href="https://redirect.github.com/tokio-rs/bytes/issues/740">#740</a>)</li> </ul> <h1>1.7.2 (September 17, 2024)</h1> <h3>Fixed</h3> <ul> <li>Fix default impl of <code>Buf::{get_int, get_int_le}</code> (<a href="https://redirect.github.com/tokio-rs/bytes/issues/732">#732</a>)</li> </ul> <h3>Documented</h3> <ul> <li>Fix double spaces in comments and doc comments (<a href="https://redirect.github.com/tokio-rs/bytes/issues/731">#731</a>)</li> </ul> <h3>Internal changes</h3> <ul> <li>Ensure BytesMut::advance reduces capacity (<a href="https://redirect.github.com/tokio-rs/bytes/issues/728">#728</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
|||
e05f387632 |
update to reedline commit 9cb1128 (#14146)
# Description Update to the latest reedline commit. # 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: - `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 toolkit.nu; toolkit test stdlib"` 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. --> |
|||
9870c7c9a6 |
Defensive handling of errors when transposing (#14096)
# Description This PR aims to close #14027, in which it was noticed that the transpose command "swallows" error messages. *Note that in exploring the linked issue, [other situations were identified](https://github.com/nushell/nushell/issues/14027#issuecomment-2414602880) which also produce inconsistent behaviour. These have knowingly been omitted from this PR, to minimize its scope, and since they seem to have a different cause. It's probably best to make a separate issue/PR in which to tackle a broader scan of error handling, with a suspected relation to streams.* # User-Facing Changes The user will see errors from deeper in the pipeline, in case the errors originated there. # Tests + Formatting Toolkit PR check was run successfully. One test was added, covering this exact situation, in order to prevent regressions. The bug is relatively obscure, so it may be prone to reappear during refactorings. |
|||
3f75b6b371 |
error when closure param lists aren't terminated by | (#14095)
Fixes #13757, fixes #9562 # User-Facing Changes - `unclosed |` is returned for malformed closure parameters: ``` { |a } ``` - Parameter list closing pipes are highlighted as part of the closure |
|||
04fed82e5e |
Feature url build_query accepts records with lists of strings (#14073)
<!-- 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. --> Swagger supports lists (a.k.a arrays) in query parameters: https://swagger.io/docs/specification/v3_0/serialization/ It supports three different styles: - explode=true - spaceDelimited - pipeDelimited With explode=true being the default and hence most common. It is the hardest to use inside of nushell, as the others are just a `string join` away. This commit adds lists with the explode=true format. # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> Before: : {a[]: [one two three], b: four} | url build-query Error: nu:🐚:unsupported_input × Unsupported input ╭─[entry #33:1:1] 1 │ {a[]: [one two three], b: four} | url build-query · ───────────────┬─────────────── ───────┬─────── · │ ╰── Expected a record with string values · ╰── value originates from here ╰──── After: : {a[]: [one two three], b: four} | url build-query a%5B%5D=one&a%5B%5D=two&a%5B%5D=three&b=four Despite reading CONTRIBUTING.md I didn't get approval before making the change. My judgment is that this doesn't qualify as being "change something significantly". # Tests + Formatting I added the Example instance for the automatic tests. I couldn't figure out how to add an Example for the error case, so I did that with manual testing. E.g.: : {a[]: [one two [three]], b: four} | url build-query Error: nu:🐚:unsupported_input × Unsupported input ╭─[entry #3:1:1] 1 │ {a[]: [one two [three]], b: four} | url build-query · ────────────────┬──────────────── ───────┬─────── · │ ╰── Expected a record with list of string values · ╰── value originates from here ╰──── : {a[]: [one two 3hr], b: four} | url build-query Error: nu:🐚:unsupported_input × Unsupported input ╭─[entry #4:1:1] 1 │ {a[]: [one two 3hr], b: four} | url build-query · ──────────────┬────────────── ───────┬─────── · │ ╰── Expected a record with list of string values · ╰── value originates from here ╰──── <!-- 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 toolkit.nu; toolkit test stdlib"` 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 ran the four cargo commands on my local machine. I had to run the tests with: LANG=C and -j 1 and even then I got one failure: thread 'commands::umkdir::mkdir_umask_permission' panicked at crates/nu-command/tests/commands/umkdir.rs:148:9: assertion `left == right` failed: Most *nix systems have 0o00022 as the umask. So directory permission should be 0o40755 = 0o 40777 & (!0o00022) left: 16893 right: 16877 but this isn't related to this change (I seem to not be running most *nix system; and don't have a lot of RAM for the number of cores). The other three cargo commands didn't have errors or warnings. # 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. --> I will add the new example to [the documentation](https://github.com/nushell/nushell.github.io). # Open questions / possible future work Things I noticed, and would like to mention and am open to adding, but don't think I am deep enough in nushell to do them pro-actively. ## Add an argument for the other query parameter list styles I don't know how frequent they are and I currently don't need them, so following KISS I didn't add them. ## long input_span marked In e.g.: : {a[]: [one two 3hr], b: four} | url build-query Error: nu:🐚:unsupported_input × Unsupported input ╭─[entry #4:1:1] 1 │ {a[]: [one two 3hr], b: four} | url build-query · ──────────────┬────────────── ───────┬─────── · │ ╰── Expected a record with list of string values · ╰── value originates from here ╰──── the entire record is marked as input_span instead of just the "3hr" that is causing the problem. Changing that would be trivial, but I'm not deep enough into nushell to understand all the consequences of changing that. ## Error message says string values despite accepting numbers etc. The error message said it only accepted strings despite accepting numbers etc. (anything it can coerce into string). I couldn't find a good wording myself and that was how it was before. I simply added a "list of strings". |
|||
f3a1dfef95 |
Fix panic if tokens are placed after a redirection (#14035)
<!-- 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 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. --> fixes #13835 The `concat` function from `span.rs` assumes that two consecutive span intervals must overlap. But when parsing `let` and `mut` expressions, we call `parts_including_redirection` which chains two slices of span and leads to the above condition not holding. So my solution here is to sort them after chaining. # 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: - `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 toolkit.nu; toolkit test stdlib"` 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. --> |
|||
f738932bbd |
Fix range contains (#14011)
# Description This PR changes the range contains logic to take the step into account. ```nushell # before 2 in 1..3.. # true # now 2 in 1..3.. # false ``` --- I encountered another issue while adding tests. Due to floating point precision, `2.1 in 1..1.1..3` will return `false`. The floating point error is even bigger than `f64::EPSILON` (`0.09999999999999876` vs `2.220446049250313e-16`). This issue disappears with bigger numbers. I tried a different algorithm (checking if the estimated number of steps is close enough to any integer) but the results are still pretty bad: ```rust let n_steps = (value - self.start) / self.step; // 14.999999999999988 (n_steps - n_steps.round()).abs() < f64::EPSILON // returns false ``` Maybe it can be shipped like this, the REPL already has floating point errors (`1.1 - 1` returns `0.10000000000000009`). Or maybe there's a way to fix this that I didn't think of. I'm open to ideas! But in any case performing this kind of checks on a range of floats seems more niche than doing it on a range of ints. # User-Facing Changes Code that depended on this behavior to check if a number is between `start` and `end` will potentially return a different value. # Tests + Formatting # After Submitting |
|||
4968b6b9d0 |
fix error when exporting consts with type signatures in modules (#14118)
Fixes #14023 # Description - Prevents "failed to find added variable" when modules export constants with type signatures: ```nushell > module foo { export const bar: int = 2 } Error: nu::parser::unknown_state × Internal error. ╭─[entry #1:1:21] 1 │ module foo { export const bar: int = 2 } · ─────────┬──────── · ╰── failed to find added variable ``` - Returns `name_is_builtin_var` errors for names with type signatures: ```nushell > let env: string = ""; Error: nu::parser::name_is_builtin_var × `env` used as variable name. ╭─[entry #1:1:5] 1 │ let env: string = ""; · ─┬─ · ╰── already a builtin variable ``` |
|||
ee97c00818 |
Make contributor image wider (#14138)
With this many contributors you otherwise have to scroll really far to get down to the license info. The alternative would be to limit the number of faces we show, but it is cool to have them all (as long as the generated svg doesn't take too long to load or generate) |
|||
1dbd431117 |
try and fix osc633 escaping yet again (#14140)
# Description This PR is meant to fix the escaping in the osc633 implementation from [PR 14008](https://github.com/nushell/nushell/pull/14008) that is specifically for vscode. The idea is to try and follow these rules better. https://code.visualstudio.com/docs/terminal/shell-integration#_vs-code-custom-sequences-osc-633-st Previously, it wouldn't escape all the characters and would only escape characters while typing escape characters. Now it should take what was typed and escape it if necessary. |
|||
09ab583f64 |
add start_time to ps -l on macos (#14127)
# Description This PR adds `start_time` to the MacOS `ps -l` command. Was requested in discord. `start_time` is displayed in `Local` time.  # 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: - `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 toolkit.nu; toolkit test stdlib"` 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. --> /cc @cablehead |
|||
9ad6d13982 |
Add slice as a search term on range (#14128)
Not to be confused with `seq` which is similar to our range type, `range` does a slice based on a range. |
|||
8d4426f2f8 |
add is_const to help commands and scope commands (#14125)
# Description This PR adds `is_const` to `help commands` and `scope commands` so we can see which commands are const commands.  |