Commit Graph

5324 Commits

Author SHA1 Message Date
Yash Thakur
6ff3a4180b
Specify which file not found in error (#11868)
# Description
Currently, `ShellError::FileNotFound` shows the span where the error
occurred but doesn't say which file wasn't found. This PR makes it so
the help includes that (like the `DirectoryNotFound` error).

# User-Facing Changes
No breaking changes, it's just that when a file can't be found, the help
will say which file couldn't be found:


![image](https://github.com/nushell/nushell/assets/45539777/e52f1e65-55c1-4cd2-8108-a4ccc334a66f)
2024-02-21 21:27:13 +08:00
Wind
1058707a29
make stderr works for failed external command (#11914)
# Description
Fixes: #11913

When running external command, nushell shouldn't consumes stderr
messages, if user want to redirect stderr.

# User-Facing Changes
NaN

# Tests + Formatting
Done

# After Submitting
NaN
2024-02-21 21:15:05 +08:00
Stefan Holderbach
6e590fe0a2
Remove unused Index(Mut) impls on AST types (#11903)
# Description
Both `Block` and `Pipeline` had `Index`/`IndexMut` implementations to
access their elements, that are currently unused.
Explicit helpers or iteration would generally be preferred anyways but
in the current state the inner containers are `pub` and are liberally
used. (Sometimes with potentially panicking indexing or also iteration)

As it is potentially unclear what the meaning of the element from a
block or pipeline queried by a usize is, let's remove it entirely until
we come up with a better API.

# User-Facing Changes
None

Plugin authors shouldn't dig into AST internals
2024-02-21 18:02:30 +08:00
Darren Schroeder
b23fe30530
fixes debug info not populating process information (#11909)
# Description

This PR fixes #11901. For some reason `debug info` stopped reporting
information. This hopefully fixes it. I think something changes in the
`sysinfo` crate that stopped it from working.

# 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 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.
-->
2024-02-20 13:34:11 -06:00
David Matos
123bf2d736
fix format date based on users locale (#11908)
<!--
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
Hi, 

Fixes #10838, where before the `date` would be formatted incorrectly,
and was not picking `LC_TIME` for time formatting, but it picked the
first locale returned by the `sys-locale` crate instead. Now it will
format time based on `LC_TIME`. For example,

```
// my locale `nl_NL.UTF-8`
❯ date now | format date '%x %X'
20-02-24 17:17:12

$env.LC_TIME = "en_US.UTF-8"

❯ date now | format date '%x %X'
02/20/2024 05:16:28 PM
```
Note that I also changed the `default_env.nu` as otherwise the Time will
show AM/PM twice. Also reason for the `chrono` update is because this
relies on a fix to upstream repo, which i initially submitted an
[issue](https://github.com/chronotope/chrono/issues/1349#event-11765363286)

<!--
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.
-->
2024-02-20 11:08:49 -06:00
dannou812
7c1eb6b0c8
move-Command Tests, Refactor, Fix (#11904)
fixes #11783 

# Description
Firstly Tests for the `move` Command have been added. Afterwards some
duplicate Code has been removed and finally an error-message has been
added for when a column is tried to be moved based on itself. This
should fix #11783 .

To reiterate, the example of the initial issue now plays out as follows:
```shell
> {a: 1} | move a --after a                             
Error: nu:🐚:incompatible_parameters

  × Incompatible parameters.
   ╭─[entry #1:1:15]
 1 │ {a: 1} | move a --after a
   ·               ┬         ┬
   ·               │         ╰── relative to itself
   ·               ╰── Column cannot be moved
   ╰────
``` 

# User-Facing Changes
The error message shown above.

# Tests + Formatting
I added some Tests for the behavior of the command. If I should add
more, please let me know but I added everything that came to mind when
thinking about the command.

---------

Co-authored-by: dannou812 <dannou281@gmail.com>
2024-02-20 07:23:46 -06:00
Darren Schroeder
63ccc62a24
allow last to work with ranges (#11906)
# Description

This PR allows `last` to work with ranges in the same way that `first`
does. It also adds a couple examples demonstrating 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 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.
-->
2024-02-20 06:28:50 -06:00
Filipe Paniguel
c0bac5a440
style: correct keybinding name and improve formatting in default_config.nu (#11889)
<!--
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 addresses a minor mismatch in a keybinding name within the
`default_config.nu` file. Additionally, it applies formatting for
consistency.
# 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 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.
-->
2024-02-18 20:50:50 -06:00
dependabot[bot]
68a3d7c430
Bump trash from 3.2.1 to 3.3.1 (#11894)
Bumps [trash](https://github.com/ArturKovacs/trash) from 3.2.1 to 3.3.1.
<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>v3.3.1</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Use <code>AtomicI32</code> instead of I64 for compatibility with
<code>armel</code></li>
</ul>
<h3>Commit Statistics</h3>
<ul>
<li>1 commit contributed to the release.</li>
<li>2 days passed between releases.</li>
<li>1 commit was understood as <a
href="https://www.conventionalcommits.org">conventional</a>.</li>
<li>1 unique issue was worked on: <a
href="https://redirect.github.com/ArturKovacs/trash/issues/99">#99</a></li>
</ul>
<h3>Commit Details</h3>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<ul>
<li><strong><a
href="https://redirect.github.com/ArturKovacs/trash/issues/99">#99</a></strong>
<ul>
<li>Use <code>AtomicI32</code> instead of I64 for compatibility with
<code>armel</code> (98049f1)</li>
</ul>
</li>
</ul>
<!-- raw HTML omitted -->
<h2>v3.3.0</h2>
<h3>New Features</h3>
<ul>
<li>improved error granularity
Inform about operating-system specific errors more clearly, thus avoid
degenerating error information.</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li>Use <code>AtomicI32</code> in tests for compatibility with
<code>armel</code> platform</li>
</ul>
<h3>Commit Statistics</h3>
<ul>
<li>5 commits contributed to the release over the course of 5 calendar
days.</li>
<li>25 days passed between releases.</li>
<li>2 commits were understood as <a
href="https://www.conventionalcommits.org">conventional</a>.</li>
<li>1 unique issue was worked on: <a
href="https://redirect.github.com/ArturKovacs/trash/issues/99">#99</a></li>
</ul>
<h3>Commit Details</h3>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<ul>
<li><strong><a
href="https://redirect.github.com/ArturKovacs/trash/issues/99">#99</a></strong>
<ul>
<li>Use <code>AtomicI32</code> in tests for compatibility with
<code>armel</code> platform (920ff0c)</li>
</ul>
</li>
<li><strong>Uncategorized</strong>
<ul>
<li>Improved error granularity (452be83)</li>
<li>Removed tracing. (2b1c9fa)</li>
</ul>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</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>3.3.1 (2024-02-12)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><!-- raw HTML omitted --> Use <code>AtomicI32</code> instead of I64
for compatibility with <code>armel</code></li>
</ul>
<h3>Commit Statistics</h3>
<!-- raw HTML omitted -->
<ul>
<li>1 commit contributed to the release.</li>
<li>2 days passed between releases.</li>
<li>1 commit was understood as <a
href="https://www.conventionalcommits.org">conventional</a>.</li>
<li>1 unique issue was worked on: <a
href="https://redirect.github.com/Byron/trash-rs/issues/99">#99</a></li>
</ul>
<h3>Commit Details</h3>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<ul>
<li><strong><a
href="https://redirect.github.com/Byron/trash-rs/issues/99">#99</a></strong>
<ul>
<li>Use <code>AtomicI32</code> instead of I64 for compatibility with
<code>armel</code> (<a
href="98049f1316"><code>98049f1</code></a>)</li>
</ul>
</li>
</ul>
<!-- raw HTML omitted -->
<h2>3.3.0 (2024-02-10)</h2>
<h3>New Features</h3>
<ul>
<li><!-- raw HTML omitted --> improved error granularity
Inform about operating-system specific errors more clearly, thus avoid
degenerating error information.</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><!-- raw HTML omitted --> Use <code>AtomicI32</code> in tests for
compatibility with <code>armel</code> platform</li>
</ul>
<h3>Commit Statistics</h3>
<!-- raw HTML omitted -->
<ul>
<li>6 commits contributed to the release over the course of 5 calendar
days.</li>
<li>25 days passed between releases.</li>
<li>2 commits were understood as <a
href="https://www.conventionalcommits.org">conventional</a>.</li>
<li>1 unique issue was worked on: <a
href="https://redirect.github.com/Byron/trash-rs/issues/99">#99</a></li>
</ul>
<h3>Commit Details</h3>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="b6e2d6c57f"><code>b6e2d6c</code></a>
Release trash v3.3.1</li>
<li><a
href="98049f1316"><code>98049f1</code></a>
fix: Use <code>AtomicI32</code> instead of I64 for compatibility with
<code>armel</code> (<a
href="https://redirect.github.com/ArturKovacs/trash/issues/99">#99</a>)</li>
<li><a
href="d0d8f26030"><code>d0d8f26</code></a>
Release trash v3.3.0</li>
<li><a
href="920ff0c69f"><code>920ff0c</code></a>
fix: Use <code>AtomicI32</code> in tests for compatibility with
<code>armel</code> platform (<a
href="https://redirect.github.com/ArturKovacs/trash/issues/99">#99</a>)</li>
<li><a
href="452be8303c"><code>452be83</code></a>
feat: improved error granularity</li>
<li><a
href="2b1c9fa2a9"><code>2b1c9fa</code></a>
Removed tracing.</li>
<li><a
href="b238938d7d"><code>b238938</code></a>
Bug fix for macOS.</li>
<li><a
href="671cef91f4"><code>671cef9</code></a>
Enhanced error reporting.</li>
<li>See full diff in <a
href="https://github.com/ArturKovacs/trash/compare/v3.2.1...v3.3.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=trash&package-manager=cargo&previous-version=3.2.1&new-version=3.3.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-19 10:21:46 +08:00
dependabot[bot]
a4ef7c1ac4
Bump fancy-regex from 0.12.0 to 0.13.0 (#11893)
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some
time.

Note: if you make any changes to this PR yourself, they will take
precedence over the rebase.

---

[//]: # (dependabot-end)

Bumps [fancy-regex](https://github.com/fancy-regex/fancy-regex) from
0.12.0 to 0.13.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.13.0</h2>
<h3>Added</h3>
<ul>
<li>Support for relative backreferences using <code>\k&lt;-1&gt;</code>
(-1 references the
previous group) (<a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/121">#121</a>)</li>
<li>Add <code>try_replacen</code> to <code>Regex</code> which returns a
<code>Result</code> instead of panicking
when matching errors (<a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/130">#130</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Switch from regex crate to regex-automata and regex-syntax (lower
level APIs)
to simplify internals (<a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/121">#121</a>)</li>
<li>Allow escaping some letters in character classes, e.g.
<code>[\A]</code> used to error
but now matches the same as <code>[A]</code> (for compatibility with
Oniguruma)</li>
<li>MSRV (minimum supported Rust version) is now 1.66.1 (from
1.61.0)</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Fix index out of bounds panic when parsing unclosed <code>(?(</code>
(<a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/125">#125</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.13.0] - 2023-12-22</h2>
<h3>Added</h3>
<ul>
<li>Support for relative backreferences using <code>\k&lt;-1&gt;</code>
(-1 references the
previous group) (<a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/121">#121</a>)</li>
<li>Add <code>try_replacen</code> to <code>Regex</code> which returns a
<code>Result</code> instead of panicking
when matching errors (<a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/130">#130</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Switch from regex crate to regex-automata and regex-syntax (lower
level APIs)
to simplify internals (<a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/121">#121</a>)</li>
<li>Allow escaping some letters in character classes, e.g.
<code>[\A]</code> used to error
but now matches the same as <code>[A]</code> (for compatibility with
Oniguruma)</li>
<li>MSRV (minimum supported Rust version) is now 1.66.1 (from
1.61.0)</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Fix index out of bounds panic when parsing unclosed <code>(?(</code>
(<a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/125">#125</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="bf2c807447"><code>bf2c807</code></a>
Version 0.13.0</li>
<li><a
href="7b4ad1178d"><code>7b4ad11</code></a>
Merge pull request <a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/129">#129</a>
from fancy-regex/changelog-0.13</li>
<li><a
href="8d8ea4fcf9"><code>8d8ea4f</code></a>
Document how to check matching in Oniguruma</li>
<li><a
href="1fab2c7e0b"><code>1fab2c7</code></a>
Add character class escaping change</li>
<li><a
href="2d6339584d"><code>2d63395</code></a>
Add try_replacen</li>
<li><a
href="6deb4fc1b2"><code>6deb4fc</code></a>
Prepare CHANGELOG for next release</li>
<li><a
href="c0e701f821"><code>c0e701f</code></a>
Merge pull request <a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/130">#130</a>
from kevinhu/try_replacen</li>
<li><a
href="55f6549bec"><code>55f6549</code></a>
Add try_replacen</li>
<li><a
href="8ab3a44053"><code>8ab3a44</code></a>
Merge branch 'fancy-regex:main' into main</li>
<li><a
href="494cd931c3"><code>494cd93</code></a>
Merge pull request <a
href="https://redirect.github.com/fancy-regex/fancy-regex/issues/126">#126</a>
from robertknight/patch-1</li>
<li>Additional commits viewable in <a
href="https://github.com/fancy-regex/fancy-regex/compare/0.12.0...0.13.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=fancy-regex&package-manager=cargo&previous-version=0.12.0&new-version=0.13.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-19 09:54:37 +08:00
dependabot[bot]
6a1691f378
Bump miette from 7.0.0 to 7.1.0 (#11892)
Bumps [miette](https://github.com/zkat/miette) from 7.0.0 to 7.1.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/zkat/miette/releases">miette's
releases</a>.</em></p>
<blockquote>
<h2>v7.1.0</h2>
<h3>Features</h3>
<ul>
<li><strong>derive:</strong> enable more boxed types to be
#[diagnostic_source] (<a
href="https://redirect.github.com/zkat/miette/issues/338">#338</a>) (<a
href="c2f06f6cca">c2f06f6c</a>)</li>
<li><strong>source:</strong> derive common traits for NamedSource,
SourceSpan, and SourceOffset (<a
href="https://redirect.github.com/zkat/miette/issues/340">#340</a>) (<a
href="6f09250cca">6f09250c</a>)</li>
<li><strong>collection:</strong> add support for collection of labels
(<a href="https://redirect.github.com/zkat/miette/issues/341">#341</a>)
(<a
href="03060245d8">03060245</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>tests:</strong> revert test-breaking changes of e5c7ae4 (<a
href="https://redirect.github.com/zkat/miette/issues/339">#339</a>) (<a
href="6e829f8c0c">6e829f8c</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/zkat/miette/blob/main/CHANGELOG.md">miette's
changelog</a>.</em></p>
<blockquote>
<h2>7.1.0 (2024-02-16)</h2>
<h3>Features</h3>
<ul>
<li><strong>derive:</strong> enable more boxed types to be
#[diagnostic_source] (<a
href="https://redirect.github.com/zkat/miette/issues/338">#338</a>) (<a
href="c2f06f6cca">c2f06f6c</a>)</li>
<li><strong>source:</strong> derive common traits for NamedSource,
SourceSpan, and SourceOffset (<a
href="https://redirect.github.com/zkat/miette/issues/340">#340</a>) (<a
href="6f09250cca">6f09250c</a>)</li>
<li><strong>collection:</strong> add support for collection of labels
(<a href="https://redirect.github.com/zkat/miette/issues/341">#341</a>)
(<a
href="03060245d8">03060245</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>tests:</strong> revert test-breaking changes of e5c7ae4 (<a
href="https://redirect.github.com/zkat/miette/issues/339">#339</a>) (<a
href="6e829f8c0c">6e829f8c</a>)</li>
</ul>
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="a18a6444d9"><code>a18a644</code></a>
chore: Release</li>
<li><a
href="dc77b0cb5b"><code>dc77b0c</code></a>
docs: update changelog</li>
<li><a
href="03060245d8"><code>0306024</code></a>
feat(collection): add support for collection of labels (<a
href="https://redirect.github.com/zkat/miette/issues/341">#341</a>)</li>
<li><a
href="6f09250cca"><code>6f09250</code></a>
feat(source): derive common traits for NamedSource, SourceSpan, and
SourceOff...</li>
<li><a
href="c2f06f6cca"><code>c2f06f6</code></a>
feat(derive): enable more boxed types to be #[diagnostic_source] (<a
href="https://redirect.github.com/zkat/miette/issues/338">#338</a>)</li>
<li><a
href="6e829f8c0c"><code>6e829f8</code></a>
fix(tests): revert test-breaking changes of e5c7ae4 (<a
href="https://redirect.github.com/zkat/miette/issues/339">#339</a>)</li>
<li>See full diff in <a
href="https://github.com/zkat/miette/compare/miette-derive-v7.0.0...miette-derive-v7.1.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=miette&package-manager=cargo&previous-version=7.0.0&new-version=7.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-19 09:54:08 +08:00
dependabot[bot]
1350f1eff7
Bump unicode-segmentation from 1.10.1 to 1.11.0 (#11891)
Bumps
[unicode-segmentation](https://github.com/unicode-rs/unicode-segmentation)
from 1.10.1 to 1.11.0.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="8b894ca626"><code>8b894ca</code></a>
Bump to 1.11.0</li>
<li><a
href="184277a5f2"><code>184277a</code></a>
Merge pull request <a
href="https://redirect.github.com/unicode-rs/unicode-segmentation/issues/130">#130</a>
from syvb/rm_old_docs</li>
<li><a
href="bfe98e4642"><code>bfe98e4</code></a>
Remove outdated documentation link in Cargo.toml</li>
<li><a
href="062c264acf"><code>062c264</code></a>
Merge pull request <a
href="https://redirect.github.com/unicode-rs/unicode-segmentation/issues/128">#128</a>
from ryanavella/master</li>
<li><a
href="6375d1e431"><code>6375d1e</code></a>
Adding missing size_hint implementations.</li>
<li><a
href="e718ec3132"><code>e718ec3</code></a>
Merge pull request <a
href="https://redirect.github.com/unicode-rs/unicode-segmentation/issues/127">#127</a>
from nicolasmendoza/docs/update-changelogs-from-v1.9....</li>
<li><a
href="e9104b117d"><code>e9104b1</code></a>
Fix: Remove duplicate changelog</li>
<li><a
href="30a3e6bab2"><code>30a3e6b</code></a>
docs: Update changelog for versions 1.9.0 to 1.10.1</li>
<li><a
href="eb794dda07"><code>eb794dd</code></a>
docs: Update changelog for versions 1.9.0 to 1.10.1</li>
<li><a
href="8d165c5842"><code>8d165c5</code></a>
Merge pull request <a
href="https://redirect.github.com/unicode-rs/unicode-segmentation/issues/126">#126</a>
from nicolasmendoza/docs/update-changelogs</li>
<li>Additional commits viewable in <a
href="https://github.com/unicode-rs/unicode-segmentation/compare/v1.10.1...v1.11.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=unicode-segmentation&package-manager=cargo&previous-version=1.10.1&new-version=1.11.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-19 09:36:31 +08:00
KITAGAWA Yasutaka
752d25b004
separate commandline into subcommands (#11877)
<!--
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.
-->
Related issue and PR, #11825 #11864 
This improves the signature of `commandline`.

## Before

`commandline` returns different types depending on the flags and an
aurgument.

| command | input | output | description |

|-----------------------------|---------|---------|----------------------------------------|
| `commandline` | nothing | string | get current cursor line |
| `commandline arg` | nothing | nothing | replace the cursor line with
`arg` |
| `commandline --append arg` | nothing | nothing | append `arg` to the
end of cursor line |
| `commandline --insert arg` | nothing | nothing | insert `arg` to the
position of cursor |
| `commandline --replace arg` | nothing | nothing | replace the cursor
line with `arg` |
| `commandline --cursor` | nothing | int | get current cursor position |
| `commandline --cursor pos` | nothing | nothing | set cursor position
to pos |
| `commandline --cursor-end` | nothing | nothing | set cursor position
to end |

`help commandline` shows that `commandline` accepts string as pipeline
input, but `commandline` ignores pipeline input.

```
Input/output types:
  ╭───┬─────────┬─────────╮
  │ # │  input  │ output  │
  ├───┼─────────┼─────────┤
  │ 0 │ nothing │ nothing │
  │ 1 │ string  │ string  │
  ╰───┴─────────┴─────────╯
```

671bd08bcd/crates/nu-cli/src/commands/commandline.rs (L70)

This is misleading.

Due to the change #11864 , typecheck does not work well.
https://github.com/nushell/nushell/pull/11864#discussion_r1491814054

## After

Separate `commandline` into subcommands so that each subcommands returns
the same type for the same input type.

| command | input | output | description |

|----------------------------------|---------|---------|----------------------------------------|
| `commandline` | nothing | string | get current cursor line |
| `commandline edit arg` | nothing | nothing | replace the cursor line
with `arg` |
| `commandline edit --append arg` | nothing | nothing | append `arg` to
the end of cursor line |
| `commandline edit --insert arg` | nothing | nothing | insert `arg` to
the position of cursor |
| `commandline edit --replace arg` | nothing | nothing | replace the
cursor line with `arg` |
| `commandline get-cursor` | nothing | int | get current cursor position
|
| `commandline set-cursor pos` | nothing | nothing | set cursor position
to pos |
| `commandline set-cursor --end` | nothing | nothing | set cursor
position to end |

# 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 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.
-->
2024-02-18 16:15:59 -06:00
Ian Manske
68fcd71898
Add Value::coerce_str (#11885)
# Description
Following #11851, this PR adds one final conversion function for
`Value`. `Value::coerce_str` takes a `&Value` and converts it to a
`Cow<str>`, creating an owned `String` for types that needed converting.
Otherwise, it returns a borrowed `str` for `String` and `Binary`
`Value`s which avoids a clone/allocation. Where possible, `coerce_str`
and `coerce_into_string` should be used instead of `coerce_string`,
since `coerce_string` always allocates a new `String`.
2024-02-18 17:47:10 +01:00
Ian Manske
fb4251aba7
Remove Record::from_raw_cols_vals_unchecked (#11810)
# Description
Follows from #11718 and replaces all usages of
`Record::from_raw_cols_vals_unchecked` with iterator or `record!`
equivalents.
2024-02-18 14:20:22 +02:00
Stefan Holderbach
28f0f32ae7
Prune unused ShellError variants (#11883)
# Description
Same procedure as #11881

Remove unused variants to avoid confusion and foster better practices
around error variants.

- Remove `SE::PermissionDeniedError`
- Remove `SE::OutOfMemoryError`
- Remove `SE::DirectoryNotFoundCustom`
- Remove `SE::MoveNotPossibleSingle`
- Remove `SE::NonUnicodeInput`

# User-Facing Changes
Plugin authors may have matched against or emitted those variants
2024-02-18 15:31:36 +08:00
Stefan Holderbach
06c590d894
Prune unused ParseError variants (#11881)
# Description
Error variants never raised should be removed to avoid confusion and
make sure we choose the proper variants in the future

- Remove unused `ParseError::InvalidModuleFileName`
- Remove unused `ParseError::NotFound`
- Remove unused `ParseError::MissingImportPattern`
- Remove unused `ParseError::ReadingFile`


# User-Facing Changes
None for users.
Insignificant for plugin authors as they interact only with `ShellError`
2024-02-18 15:31:02 +08:00
yuri@FreeBSD
0487e9ffcb
FreeBSD compatibility patches (#11869)
# Description

nushell is verified to work on FreeBSD 14 with these patches.

What isn't supported on FreeBSD:
* the crate 'procfs' doesn't support FreeBSD yet, all functionality
depending on procfs is disabled
* several RLIMIT_* values aren't supported on FreeBSD - functions
related to these are disabled




# User-Facing Changes
n/a

# Tests + Formatting
n/a

# After Submitting
n/a

---------

Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
2024-02-17 20:04:59 +01:00
Ian Manske
1c49ca503a
Name the Value conversion functions more clearly (#11851)
# Description
This PR renames the conversion functions on `Value` to be more consistent.
It follows the Rust [API guidelines](https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv) for ad-hoc conversions.
The conversion functions on `Value` now come in a few forms:
- `coerce_{type}` takes a `&Value` and attempts to convert the value to
`type` (e.g., `i64` are converted to `f64`). This is the old behavior of
some of the `as_{type}` functions -- these functions have simply been
renamed to better reflect what they do.
- The new `as_{type}` functions take a `&Value` and returns an `Ok`
result only if the value is of `type` (no conversion is attempted). The
returned value will be borrowed if `type` is non-`Copy`, otherwise an
owned value is returned.
- `into_{type}` exists for non-`Copy` types, but otherwise does not
attempt conversion just like `as_type`. It takes an owned `Value` and
always returns an owned result.
- `coerce_into_{type}` has the same relationship with `coerce_{type}` as
`into_{type}` does with `as_{type}`.
- `to_{kind}_string`: conversion to different string formats (debug,
abbreviated, etc.). Only two of the old string conversion functions were
removed, the rest have been renamed only.
- `to_{type}`: other conversion functions. Currently, only `to_path`
exists. (And `to_string` through `Display`.)

This table summaries the above:
| Form | Cost | Input Ownership | Output Ownership | Converts `Value`
case/`type` |
| ---------------------------- | ----- | --------------- |
---------------- | -------- |
| `as_{type}` | Cheap | Borrowed | Borrowed/Owned | No |
| `into_{type}` | Cheap | Owned | Owned | No |
| `coerce_{type}` | Cheap | Borrowed | Borrowed/Owned | Yes |
| `coerce_into_{type}` | Cheap | Owned | Owned | Yes |
| `to_{kind}_string` | Expensive | Borrowed | Owned | Yes |
| `to_{type}` | Expensive | Borrowed | Owned | Yes |

# User-Facing Changes
Breaking API change for `Value` in `nu-protocol` which is exposed as
part of the plugin API.
2024-02-17 18:14:16 +00:00
Darren Schroeder
360ebeb0bc
update to the latest reedline and rusqlite (#11878)
# Description

This updates nushell to the latest reedline and rusqlite dependencies.

# 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 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.
-->
2024-02-17 09:32:17 -06:00
Stefan Holderbach
7f1e025cc9
Bump roxmltree to 0.19 (#11876)
Manual changes to adapt to new error variants. Error text adapted from
docs.

Supersedes #11605
2024-02-17 09:07:50 -06:00
Stefan Holderbach
1b220815b9
Bump calamine to 0.24 (#11874)
# Description
Update `DataType` to `Data` enum due to breaking change
Supersedes #11834

# User-Facing Changes
None obvious
2024-02-17 09:05:55 -06:00
Jakub Žádník
671bd08bcd
Remove unnecessary engine state clone (#11872)
<!--
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.
-->

Just randomly found a redundant clone. Seems to work just fine without
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 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.
-->
2024-02-17 11:34:11 +02:00
KITAGAWA Yasutaka
bce2627e45
Fix panic in seq date (#11871)
<!--
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
Fix #11732 

<!--
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. -->
Invalid output format causes an error, not a panic.
```nu
❯ seq date --output-format '%H-%M-%S'
Error:   × Invalid output format
   ╭─[entry #1:1:1]
 1 │ seq date --output-format '%H-%M-%S'
   · ────┬───
   ·     ╰── an error occurred when formatting an argument
   ╰────
```
# 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.
-->
2024-02-17 10:51:20 +02:00
Ian Manske
903afda6d9
Remove required positional arg for some file system commands (#11858)
# Description
Fixes (most of) #11796. Some filesystem commands have a required
positional argument which hinders spreading rest args. This PR removes
the required positional arg from `rm`, `open`, and `touch` to be
consistent with other filesystem commands that already only have a
single rest arg (`mkdir` and `cp`).

# User-Facing Changes
`rm`, `open`, and `touch` might no longer error when they used to, but
otherwise there should be no noticeable changes.
2024-02-15 17:25:50 +00:00
dependabot[bot]
317653d5d2
Bump which from 5.0.0 to 6.0.0 (#11832) 2024-02-15 14:43:56 +00:00
KITAGAWA Yasutaka
a20b24a712
Fix commandline --cursor to return int (#11864)
<!--
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.
-->
Fix #11825 

# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
`commandline --cursor` returns int.

# 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.
-->
2024-02-15 08:17:38 -06:00
Ian Manske
74d62581b9
Remove list of cell path support for select and reject (#11859)
# Description
Requires each of the rest args for `select` and `reject` to be a cell
path instead of the current `oneof(cellpath, list<cellpath>`. This
simplifies the command signatures and code for `select` and `reject`.
Users can now spread lists into the rest arguments instead of providing
them as is.

For example,
```nushell
ls | select [name size]
```
must now be
```nushell
ls | select ...[name size]
```

# User-Facing Changes
Breaking change for the `select` and `reject` command signatures.
2024-02-15 07:49:48 -06:00
Jack Wright
525acf9d9e
Ability to cast a dataframe's column to a different dtype (#11803)
Provides the ability to cast columns in dataframes, lazy dataframes, and
expressions.

<img width="587" alt="Screenshot 2024-02-14 at 13 53 01"
src="https://github.com/nushell/nushell/assets/56345/b894f746-0e37-472e-9fb0-eb6f71f2bf27">

<img width="616" alt="Screenshot 2024-02-14 at 13 52 37"
src="https://github.com/nushell/nushell/assets/56345/cf10efa7-d89c-4189-ab71-d368b2354d19">

<img width="626" alt="Screenshot 2024-02-14 at 13 54 58"
src="https://github.com/nushell/nushell/assets/56345/cd57cdf0-5096-41dd-8ab5-46e3d1e061b8">

---------

Co-authored-by: Jack Wright <jack.wright@disqo.com>
2024-02-14 18:15:00 -06:00
Yash Thakur
cb67de675e
Disallow spreading lists automatically when calling externals (#11857)
<!--
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.
-->

Spreading lists automatically when calling externals was deprecated in
0.89 (#11289), and this PR is to remove it in 0.91.

# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

The new error message looks like this:

```
>  ^echo [1 2]
Error: nu:🐚:cannot_pass_list_to_external

  × Lists are not automatically spread when calling external commands
   ╭─[entry #13:1:8]
 1 │  ^echo [1 2]
   ·        ──┬──
   ·          ╰── Spread operator (...) is necessary to spread lists
   ╰────
  help: Either convert the list to a string or use the spread operator, like so: ...[1 2]
```

The old error message didn't say exactly where to put the `...` and
seemed to confuse a lot of people, so hopefully this helps.

# 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
> ```
-->

There was one test to check that implicit spread was deprecated before,
updated that to check that it's disallowed now.

# 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-02-14 18:16:19 -05:00
Wind
fd7eef1499
refactor: move du from platform to filesystem (#11852)
# Description
`du` command shouldn't belong to `platform`, so I think we should move
it to `filesystem` directory
2024-02-15 06:55:21 +08:00
Darren Schroeder
a603b067e5
update default_config with new defaults (#11856)
# Description

Update a few defaults.
1. use_ls_colors_completeions defaults to true.
2. make ide_menu only offer 10 completions at a time with
`max_completion_height = 10` instead of taking the entire screen.

# 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 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.
-->
2024-02-14 13:01:27 -06:00
dannou812
b0600449e5
Fixed to/from toml date format (#11846)
With this PR i try to resolve #11751 

# Description
I am rather new to Rust so if anything is not the way it should be
please let me know.

As described in the title I just fixed the date conversion in the to and
from toml commands as i thought it would be a good first issue. The
example of the original issue will now work as follows:

```
~> {date: 2024-02-02} | to toml
date = "2024-02-02T00:00:00+00:00"
~> "dob = 1979-05-27T07:32:00-08:00" | from toml
╭─────┬───────────────────────────╮
│ dob │ 44 years ago              |
╰─────┴───────────────────────────╯
```

The `from toml` command now returns a nushell date which is displayed as
`44 years ago` in this case.

# User-Facing Changes
none

# Tests + Formatting
all tests pass and formatting has been applied

---------

Co-authored-by: dannou812 <dannou281@gmail.com>
Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2024-02-14 12:13:33 -06:00
Ian Manske
779a3c075e
Fix error message for headers (#11809)
# Description
Fixes #11780: `headers`: incorrect error
2024-02-14 00:14:23 +00:00
Ian Manske
d77eeeb5dd
Prevent duplicate keys for lazy make (#11808)
# Description
Fixes #11755: `lazy make` also allows duplicate record keys
2024-02-14 00:00:52 +00:00
Ian Manske
7a181960b7
Prevent duplicate records keys when decoding from nuon (#11807)
# Description
Fixes #11749: `from nuon` allows duplicate record keys
2024-02-13 23:59:14 +00:00
Christopher Durham
1bf016bae3
Simplify prompt tilde substitution (#11822)
# Description

Simplify the tilde substitution in `create_left_prompt` by using `path
relative-to`.

# User-Facing Changes

The default `env.nu` is simpler.

# Tests

I've been happily using this formulation in my prompt command for a
while now.
2024-02-13 06:28:52 -06:00
nibon7
da4c918392
Bump polars from 0.36 to 0.37 (#11848)
# Description
Bump polars from 0.36 to 0.37

# 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 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.
-->
2024-02-13 06:27:30 -06:00
pin
005b8b02b2
Allow building on NetBSD (#11823)
Fixes https://github.com/nushell/nushell/issues/11814
2024-02-11 08:03:17 -06:00
Steven
5042f19d1b
colored file-like completions (#11702)
<!--
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.
-->

`ls` and other file completions uses `LS_COLORS`.

![maim-2024 01 31 21 34
31](https://github.com/nushell/nushell/assets/15631555/d5c3813f-77b5-4391-aa0b-4b2125e5aca5)


# 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 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-02-08 14:29:28 -06:00
Wind
58c6fea60b
Support redirect stderr and stdout+stderr with a pipe (#11708)
# Description
Close: #9673
Close: #8277
Close: #10944

This pr introduces the following syntax:
1. `e>|`, pipe stderr to next command. Example: `$env.FOO=bar nu
--testbin echo_env_stderr FOO e>| str length`
2. `o+e>|` and `e+o>|`, pipe both stdout and stderr to next command,
example: `$env.FOO=bar nu --testbin echo_env_mixed out-err FOO FOO e+o>|
str length`

Note: it only works for external commands. ~There is no different for
internal commands, that is, the following three commands do the same
things:~ Edit: it raises errors if we want to pipes for internal
commands
``` 
❯ ls e>| str length
Error:   × `e>|` only works with external streams
   ╭─[entry #1:1:1]
 1 │ ls e>| str length
   ·    ─┬─
   ·     ╰── `e>|` only works on external streams
   ╰────

❯ ls e+o>| str length
Error:   × `o+e>|` only works with external streams
   ╭─[entry #2:1:1]
 1 │ ls e+o>| str length
   ·    ──┬──
   ·      ╰── `o+e>|` only works on external streams
   ╰────
```

This can help us to avoid some strange issues like the following:

`$env.FOO=bar (nu --testbin echo_env_stderr FOO) e>| str length`

Which is hard to understand and hard to explain to users.

# User-Facing Changes
Nan

# Tests + Formatting
To be done

# After Submitting
Maybe update documentation about these syntax.
2024-02-09 01:30:46 +08:00
dependabot[bot]
e7f1bf8535
Bump indexmap from 2.1.0 to 2.2.2 (#11746) 2024-02-08 12:31:41 +00:00
nibon7
84517138bc
Bump miette from 5.10.0 to 7.0.0 (#11788)
<!--
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

Bump miette from 5.10.0 to 7.0.0

# 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 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.
-->

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2024-02-07 19:26:18 -06:00
Andrej Kolchin
fb7f6fc08b
Fix a panic when parsing empty file (#11314)
The previous implementation presumed that if files were given, they had
contents. The change makes the fallback to permanent files uniform.

Fix #11256
2024-02-07 18:47:44 -06:00
nibon7
4de9a3eb34
Apply clippy fixes (#11770)
# Description
Clippy fixes for
[items_after_test_module](https://rust-lang.github.io/rust-clippy/master/index.html#/items_after_test_module)

# 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 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.
-->
2024-02-07 18:31:03 -06:00
Antoine Büsch
b2092df27e
Upgrade to ratatui 0.26 (#11742)
# Description
Upgrade `ratatui` to 0.26

# User-Facing Changes
n/a
2024-02-08 08:15:45 +08:00
KITAGAWA Yasutaka
09f513bb53
Allow comments in match blocks (#11717)
<!--
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.
-->
Fix #9878 

# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
Writing comments in match blocks will be allowed.

# 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.
-->
2024-02-08 07:22:42 +08:00
Ian Manske
857c522808
Fix #11750: LazyRecord error message (#11772)
# Description
Makes `LazyRecord`s have the same error message as regular `Records` for
`Value::follow_cell_path`. Fixes #11750.
2024-02-08 07:22:15 +08:00
Antoine Büsch
9fa2b77611
Allow specifying a cellpath in input list to get the value to display (#11748)
# Description
When using a table (or a list of records) as input to `input list`,
allow specifying a cellpath for the field/column to use as the display
value.

For instance, at the moment, using a table as input results in the
following:

```
❯ [[name price]; [Banana 12] [Kiwi 4] [Pear 7]] | input list
> {name: Banana, price: 12}
  {name: Kiwi, price: 4}
  {name: Pear, price: 7}
```

With the new `--display` flag introduced by this PR, you can do the
following:

```
❯ [[name price]; [Banana 12] [Kiwi 4] [Pear 7]] | input list -d name
> Banana
  Kiwi
  Pear
```

Note that it doesn't change what gets returned after selecting an item:
the full row/record is still returned.

# User-Facing Changes
A new optional flag is allowed.

# Tests + Formatting

# After Submitting
2024-02-08 07:21:47 +08:00
Ian Manske
f8a8eca836
Record cleanup (#11726)
# Description
Does a little cleanup in `record.rs`:
- Makes the `record!` macro more hygienic.
- Converts regular comments to doc comments from #11718.
- Converts the `Record` iterators to new types.
2024-02-08 06:43:12 +08:00