Commit Graph

6735 Commits

Author SHA1 Message Date
pyz4
470d130289
polars cast: add decimal option for dtype parameter (#15464)
<!--
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
This PR expands the `dtype` parameter of the `polars cast` command to
include `decimal<precision, scale>` type. Setting precision to "*" will
compel inferring the value. Note, however, setting scale to a
non-integer value will throw an explicit error (the underlying polars
crate assigns scale = 0 in such a case, but I opted for throwing an
error instead). .

```
$ [[a b]; [1 2] [3 4]] | polars into-df | polars cast decimal<4,2> a | polars schema
╭───┬──────────────╮
│ a │ decimal<4,2> │
│ b │ i64          │
╰───┴──────────────╯

$ [[a b]; [10.5 2] [3.1 4]] | polars into-df | polars cast decimal<*,2> a | polars schema
╭───┬──────────────╮
│ a │ decimal<*,2> │
│ b │ i64          │
╰───┴──────────────╯

$ [[a b]; [10.05 2] [3.1 4]] | polars into-df | polars cast decimal<5,*> a | polars schema
rror:   × Invalid polars data type
   ╭─[entry #25:1:47]
 1 │ [[a b]; [10.05 2] [3.1 4]] | polars into-df | polars cast decimal<5,*> a | polars schema
   ·                                               ─────┬─────
   ·                                                    ╰── `*` is not a permitted value for scale
   ╰────
```

# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
There are no breaking changes. The user has the additional option to
`polars cast` to a decimal type

# Tests + Formatting
Tests have been added to
`nu_plugin_polars/src/dataframe/values/nu_schema.rs`
2025-04-01 16:22:05 -07:00
Darren Schroeder
a23e96c945
update human-date-parser to 3.0 (#15426)
# Description

There's been much debate about whether to keep human-date-parser in
`into datetime`. We saw recently that a new version of the crate was
released that addressed some of our concerns. This PR is to make it
easier to test those fixes.

# 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.
-->
2025-04-01 07:18:11 -05:00
132ikl
9ba16dbdaf
Add boolean examples to any and all (#15442)
<!--
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.
-->

Follow-up to #15277 and #15392.

Adds examples to `any` and `all` demonstrating using `any {}` or `all
{}` with lists of booleans.

We have a couple options that work for this use-case, but not sure which
we should recommend. The PR currently uses (1).
1. `any {}` / `all {}`
2. `any { $in }` / `all { $in }`
3. `any { $in == true }` / `all { $in == true }`

Would love to hear your thoughts on the above @fennewald @mtimaN
@fdncred @NotTheDr01ds @ysthakur

# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
* Added an extra example for `any` and `all`

# 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
> ```
-->
N/A
# 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.
-->
N/A
2025-04-01 07:17:36 -05:00
Wind
43f9ec295f
remove -s, -p in do (#15456)
# Description
Closes #15450

# User-Facing Changes
do can't use `-s`, `-p` after this pr

# Tests + Formatting
Removed 3 tests.

# After Submitting
NaN
2025-04-01 07:17:05 -05:00
Wind
f39e5b3f37
Update rand and rand_chacha to 0.9 (#15463)
# Description
As description, I think it's worth to move forward to update rand and
rand_chacha to 0.9.

# User-Facing Changes
Hopefully none

# Tests + Formatting
NaN

# After Submitting
NaN
2025-04-01 07:15:39 -05:00
zc he
6c0b65b570
feat(completion): stdlib virtual path completion & exportable completion (#15270)
# Description

More completions for `use` command.

~Also optimizes the span fix of #15238 to allow changing the text after
the cursor.~

# User-Facing Changes

<img width="299" alt="image"
src="https://github.com/user-attachments/assets/a5c45f46-40e4-4c50-9408-7b147ed11dc4"
/>

<img width="383" alt="image"
src="https://github.com/user-attachments/assets/fbeec173-511e-4c72-8995-bc1caa3ef0d3"
/>


# Tests + Formatting

+3

# After Submitting
2025-04-01 07:13:07 -05:00
migraine-user
ca4222277e
Fix typo in doc_config.nu + small description (#15461)
# Description

```
# table.*
# table_mode (string):
# One of: "default", "basic", "compact", "compact_double", "heavy", "light", "none", "reinforced",
# "rounded", "thin", "with_love", "psql", "markdown", "dots", "restructured", "ascii_rounded",
# or "basic_compact"
# Can be overridden by passing a table to `| table --theme/-t`
$env.config.table.mode = "default"
```
In `doc_config.nu`, it refers to `table_mode` which does not exist under
`$env.config.table`. There is now a short description of this field as
well.
2025-03-31 21:38:50 +02:00
Yash Thakur
5c2bcd068b
Enable exact match behavior for any path with slashes (#15458)
# Description

Closes #14794. This PR enables the strict exact match behavior requested
in #13204 and #14794 for any path containing a slash (#13302 implemented
this for paths ending in slashes).

If any of the components along the way *don't* exactly match a
directory, then the next components will use the old Fish-like
completion behavior rather than the strict behavior.

This change only affects those using prefix matching. Fuzzy matching
remains unaffected.

# User-Facing Changes

Suppose you have the following directory structure:
```
- foo
  - bar
    - xyzzy
  - barbaz
    - xyzzy
- foobar
  - bar
    - xyzzy
  - barbaz
    - xyzzy
```

- If you type `cd foo<TAB>`, you will be suggested `[foo, foobar]`
- This is because `foo` is the last component of the path, so the strict
behavior isn't activated
  - Similarly, `foo/bar` will show you `[foo/bar, foo/barbaz]`
- If you type `foo/bar/x`, you will be suggested `[foo/bar/xyzzy]`
  - This is because `foo` and `bar` both exactly matched a directory
- If you type `foo/b/x`, you will be suggested `[foo/bar/xyzzy,
foo/barbaz/xyzzy]`
- This is because `foo` matches a directory exactly, so `foobar/*` won't
be suggested, but `b` doesn't exactly match a directory, so both `bar`
and `barbaz` are suggested
- If you type `f/b/x`, you will be suggested all four of the `xyzzy`
files above
- If you type `f/bar/x`, you will be suggested all four of the `xyzzy`
files above
- Since `f` doesn't exactly match a directory, every component after it
won't use the strict matching behavior (even though `bar` exactly
matches a directory)

# Tests + Formatting

# After Submitting

This is a pretty minor change but should be mentioned somewhere in the
release notes in case it surprises someone.

---------

Co-authored-by: 132ikl <132@ikl.sh>
2025-03-31 14:19:09 -04:00
Yash Thakur
9aba96604b
Revert "Improve completions for exact matches (Issue #14794)" (#15457)
Reverts nushell/nushell#15387

As pointed out by @132ikl in
https://github.com/nushell/nushell/pull/15387#issuecomment-2764852850,
#15387 had the unintended side effect of not showing all suggestions in
certain cases when that wasn't desired.
2025-03-30 23:41:42 -04:00
vansh284
7be90c2644
Improve completions for exact matches (Issue #14794) (#15387)
<!--
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!
-->
Fixes #14794.
# Description
<!--
Thank you for improving Nushell. Please, check our [contributing
guide](../CONTRIBUTING.md) and talk to the core team before making major
changes.

Description of your pull request goes here. **Provide examples and/or
screenshots** if your changes affect the user experience.
-->

# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
Makes it so that (even if) the command ends in a slash, exact matches
are still preferred over partial matches.
For example, `foo/bar/as` -> `foo/bar/asdf` but not `foo/bars/asdf`.
# 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.
-->

---------

Co-authored-by: Yash Thakur <45539777+ysthakur@users.noreply.github.com>
2025-03-30 19:56:11 -04:00
zc he
334cf1862a
feat(lsp): parse_warnings in diagnostics report (#15449)
# Description

Add parse warnings to LSP diagnostics, not particularly useful but
technically should be done.

# User-Facing Changes

# Tests + Formatting

There's no deprecated command to test for now.

# After Submitting
2025-03-29 07:16:44 -05:00
Douglas
49d86855ce
Fixes clip copy stripping control characters when de-ansifying (#15428)
Fixes #15414 by changing the method used to de-ansi-fy the input. Control characters will now be kept when using `clip copy`, but ANSI escape codes will be removed (when not using `--ansi (-a)`)
2025-03-28 19:15:17 -04:00
zc he
5fe97b8d59
fix(completion): completions.external.enable config option not respected (#15443)
Fixes #15441 

# Description

Actually I made a small change to the original behavior:

```
^foo<tab>
```
will still show external commands, regardless of whether it's enabled or
not. I think that's the only thing people want to see when they press
tab with a `^` prefix.

# User-Facing Changes

# Tests + Formatting

+1

# After Submitting

Should I document that minor behavior change somewhere in GitHub.io?

---------

Co-authored-by: Yash Thakur <45539777+ysthakur@users.noreply.github.com>
2025-03-28 18:00:05 -04:00
Loïc Riegel
2bad1371f0
Bugfix/into datetime ignores timezone with format (#15370)
Close #15119 when this is merged

# Description

> Note: my locale is +1

**Before the changes 🔴**

![2025-03-21_00h07_22](https://github.com/user-attachments/assets/6b7db5a7-5541-4a84-9b6a-466a72a6fece)

See the issue for more detailed description of the problem.

**After the changes 🟢**

![2025-03-21_00h07_36](https://github.com/user-attachments/assets/92ec79d8-351c-4fa6-a21d-f0a867a76283)

# User-Facing Changes
The ``into datetime`` command will now work with formatting and time
zones or offset together

# Tests + Formatting
Fmt + clippy OK

**Note about the tests I added**: those tests don't really test my
changes, as they were already passing before my changes. Nevertheless I
thought I could push them

# After Submitting
I don't think anything is necessary
2025-03-28 10:51:42 -05:00
Loïc Riegel
5d32cd2c40
refactor: ensure range is bounded (#15429)
No linked issue, it's a follow-up of 2 PRs I recently made to improve
some math commands. (#15319)

# Description
Small refactor to simplify the code. It was suggested in the comments of
my previous PR.

# User-Facing Changes
None

# Tests + Formatting
Tests, fmt and clippy OK

# After Submitting
Nothing more required
2025-03-27 14:25:55 +01:00
莯凛
07be33c119
fix(nu-command): support ACL, SELinux, e.g. in cd have_permission check (#15360)
fixes #8095


# Description


This approach is a bit straightforward, call access() check with the
flag `X_OK`.

Zsh[^1], Fish perform this check by the same approach.

[^1]:
435cb1b748/Src/exec.c (L6406)

It could also avoid manual xattrs check on other *nix platforms.

BTW, the execution bit for directories in *nix world means permission to
access it's content,
while the read bit means to list it's content. [^0]

[^0]: https://superuser.com/a/169418

# User-Facing Changes

Users could face less permission check bugs in their `cd` usage.

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

---------

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
2025-03-27 14:23:41 +01:00
Jack Wright
eaf522b41f
Polars cut (#15431)
- fixes #15366 

# Description
Introducing binning commands, `polars cut` and `polars qcut`

# User-Facing Changes
- New command `polars cut`
- New command `polars qcut`
2025-03-27 06:58:34 -05:00
Solomon
e76586ede4
reset argument/redirection state after eval_call errors (#15400)
Closes #15395

# User-Facing Changes

Certain errors no longer leave the argument stack in an unexpected
state:

```diff
 let x: any = 1; try { $x | get path } catch { print caught }
-$.path # extra `print` argument from the failed `get` call
 caught
```

# Description

If `eval_call` fails in `check_input_types` or `gather_arguments`, the
cleanup code is still executed.
2025-03-26 19:41:16 -04:00
dependabot[bot]
1979b61a92
build(deps): bump tokio from 1.43.0 to 1.44.1 (#15419) 2025-03-26 14:12:42 +00:00
zc he
02fcc485fb
fix(parser): skip eval_const if parsing errors detected to avoid panic (#15364)
Fixes #14972 #15321 #14706

# Description

Early returns `NotAConstant` if parsing errors exist in the
subexpression.

I'm not sure when the span of a block will be None, and whether there're
better ways to handle none block spans, like a more suitable ShellError
type.

# User-Facing Changes

# Tests + Formatting

+1, but possibly not the easiest way to do it.

# After Submitting
2025-03-26 15:02:26 +01:00
zc he
55e05be0d8
fix(parser): comments in subexpressions of let/mut (#15375)
Closes #15305

# Description

Basically turns off `skip_comments` of the lex function for right hand
side expressions of `let`/`mut`, just as in `parse_const`.

# User-Facing Changes

Should be none.

# Tests + Formatting

+1

# After Submitting
2025-03-25 21:28:06 +01:00
zc he
e10ac2ede6
fix: command open sets default flags when calling "from xxx" converters (#15383)
Fixes #13722

# Description

Simple solution: `eval_block` -> `eval_call` with empty arguments

# User-Facing Changes

Should be none.

# Tests + Formatting

+1

# After Submitting
2025-03-25 17:40:20 +01:00
zc he
bf1f2d5ebd
fix(completion): ls_color for ~/xxx symlinks (#15403)
# Description

Get style with expanded real path, so that symlinks get highlighted
correctly.

# User-Facing Changes

Before:

<img width="255" alt="image"
src="https://github.com/user-attachments/assets/b1a11cb8-e3d3-4287-bb3b-7d0ec36ba51f"
/>

After:

<img width="255" alt="image"
src="https://github.com/user-attachments/assets/71476b2c-6a31-4d37-8d25-b187a6b4e4d5"
/>


# Tests + Formatting

# After Submitting
2025-03-24 07:50:38 -05:00
Firegem
f33a26123c
Fix path add bug when given a record (#15379)
`path add`, when given a record, sets `$env.PATH` according to the value
of the key matching `$nu.os-info.name`. There already existed a check in
place to ensure the correct column existed, but it was never reached
because of an early error on `path expand`ing `null`. This has been
fixed, as well as the out-of-date reference to "darwin" instead of
"macos" in the example.

# User-Facing Changes

`path add` now simply ignores a record that doesn't include a key for the current OS

`path add` also will no longer add duplicate paths.
2025-03-22 08:42:20 -04:00
Douglas
7c160725ed
Rename user-facing 'date' to 'datetime' (#15264)
We only have one valid `datetime` type, but the string representation of
that type was `date`. This PR updates the string representation of the
`datetime` type to be `datetime` and updates other affected
dependencies:

* A `describe` example that used `date`
* The style computer automatically recognized the new change, but also
changed the default `date: purple` to `datetime: purple`.
* Likewise, changed the `default_config.nu` to populate
`$env.config.color_config.datetime`
* Likewise, the dark and light themes in `std/config`
* Updates tests
* Unrelated, but changed the `into value` error messages to use
*"datetime"* if there's an issue.

Fixes #9916 and perhaps others.

## Breaking Changes:

* Code that expected `describe` to return a `date` will now return a
`datetime`
* User configs and themes that override `$env.config.color_config.date`
will need to be updated to use `datetime`
2025-03-21 13:36:21 -04:00
zc he
5832823dff
fix: flatten of empty closures (#15374)
Closes #15373

# Description

Now `ast -f "{||}"` will return

```
╭─content─┬─────shape─────┬─────span──────╮
│ {||}    │ shape_closure │ ╭───────┬───╮ │
│         │               │ │ start │ 0 │ │
│         │               │ │ end   │ 4 │ │
│         │               │ ╰───────┴───╯ │
╰─────────┴───────────────┴───────────────╯
```

Similar to those of `ast -f "[]"`/`ast -f "{}"`

# User-Facing Changes

# Tests + Formatting

I didn't find the right place to do the test, except for the examples of
`ast` command.

# After Submitting
2025-03-21 06:35:18 -05:00
Solomon
3fe355c4a6
enable streaming in random binary/chars (#15361)
# User-Facing Changes

- `random binary` and `random chars` now stream, reducing memory usage
  and allowing interruption with ctrl-c
2025-03-20 19:51:22 +01:00
Solomon
dd56c813f9
preserve variable capture spans in blocks (#15334)
Closes #15160

# User-Facing Changes

Certain "variable not found" errors no longer highlight the surrounding
block.

Before:

```nushell
do {
  match foo {
    _ => $in
  }
}

Error: nu:🐚:variable_not_found

  × Variable not found
   ╭─[entry #1:1:1]
 1 │ ╭─▶ do {
 2 │ │     match foo {
 3 │ │       _ => $in
 4 │ │     }
 5 │ ├─▶ }
   · ╰──── variable not found
```

After:

```nushell
Error: nu:🐚:variable_not_found

  × Variable not found
   ╭─[entry #1:3:10]
 2 │   match foo {
 3 │     _ => $in
   ·          ─┬─
   ·           ╰── variable not found
```
2025-03-20 14:20:28 -04:00
Stefan Holderbach
7a6cfa24fc
Fix to nuon --serialize of closure (#15357)
# Description
Closes #15351

Adds quotes that were missed in #14698 with the proper escaping.


# User-Facing Changes
`to nuon --serialize` will now produce a quoted string instead of
illegal nuon when given a closure

# Tests + Formatting
Reenable the `to nuon` rejection of closures in the base state test.
Added test for quoting.
2025-03-20 17:50:36 +01:00
Loïc Riegel
2ea2a904e8
Math commands can work with bounded ranges and produce list of numbers (#15319)
No associated issue, but follows up #15135. See also discussion on
[discord](https://discord.com/channels/601130461678272522/1349139634281513093/1349139639356624966)
with @sholderbach

# Description

### Math commands `range -> list<number>`

This enables the following math commands:
- abs
- ceil
- floor
- log
- round

to work with ranges. When a range is given, the command will apply the
command on each item of the range, thus producing a list of number as
output.

Example

![image](https://github.com/user-attachments/assets/cff12724-5b26-4dbb-a979-a91c1b5652fc)

The commands still do not work work with unbounded ranges:


![image](https://github.com/user-attachments/assets/40c766a8-763f-461d-971b-2d58d11fc3a6)

And I left out the "mode" command because I think it does not make sense
to use it on ranges...

### Math commands `range -> number`

This was the topic of my previous PR, but for whatever reason I didn't
do `math variance` and `math stddev`.
I had to use `input.try_expand_range` to convert the range into a list
before computing the variance/stddev.


![image](https://github.com/user-attachments/assets/803954e7-1c2a-4c86-8b16-e16518131138)

And same, does not work in infinite ranges:


![image](https://github.com/user-attachments/assets/8bfaae2b-34cc-453d-8764-e42c815d28d3)

### Also done:
- find link in documentation

# User-Facing Changes
- Command signatures changes
- ability to use some commands with unbounded ranges
- ability to use variance and stddev with bounded ranges

# Tests + Formatting
Cargo fmt and clippy OK
Tests OK

# After Submitting
I guess nothing, or maybe release notes?
2025-03-20 17:35:50 +01:00
Ian Manske
dfba62da00
Remove nu-glob's dependency on nu-protocol (#15349)
# Description

This PR solves a circular dependency issue (`nu-test-support` needs
`nu-glob` which needs `nu-protocol` which needs `nu-test-support`). This
was done by making the glob functions that any type that implements
`Interruptible` to remove the dependency on `Signals`.

# After Submitting

Make `Paths.next()` a O(1) operation so that cancellation/interrupt
handling can be moved to the caller (e.g., by wrapping the `Paths`
iterator in a cancellation iterator).
2025-03-20 17:32:41 +01:00
dependabot[bot]
946cef77f1
build(deps): bump uuid from 1.12.0 to 1.16.0 (#15346) 2025-03-20 15:46:25 +00:00
dependabot[bot]
c99c8119fe
build(deps): bump indexmap from 2.7.0 to 2.8.0 (#15345) 2025-03-20 15:45:58 +00:00
zc he
2b4914608e
fix(completion): inline defined custom completion (#15318)
Fixes #6001 

# Description

<img width="485" alt="image"
src="https://github.com/user-attachments/assets/5aad23ee-07ec-4f1b-8410-a484c2210cd3"
/>

# User-Facing Changes

# Tests + Formatting

+1

# After Submitting
2025-03-20 16:44:41 +01:00
132ikl
8b80ceac32
Add From<IoError> for LabeledError (#15327)
<!--
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 an `impl From<IoError> for LabeledError`, similar to the existing
`From<ShellError>` implementation. Helpful for plugins.

# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
N/A 
# 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
> ```
-->
N/A
# 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.
-->
N/A
2025-03-20 11:42:31 -04:00
zc he
e89bb2ee96
fix(lsp): verbose signature help response for less well supported editors (#15353)
# Description

Some editors (like zed) will fail to mark the active parameter if not
set in the outmost structure.

# User-Facing Changes

# Tests + Formatting

Adjusted

# After Submitting
2025-03-20 09:55:03 -05:00
Darren Schroeder
862d53bb6e
add more columns to macos ps -l (#15341)
# Description

This PR adds a few more columns to the macos version of `ps -l` to bring
it more inline with the Linux and Windows version.

Columns added: user_id, priority, process_threads

I also added some comments that describe the TaskInfo structure. I
couldn't find any good information to add to the BSDInfo structure.

# 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.
-->
2025-03-20 09:53:19 -05:00
Ian Manske
968eb45fb2
Don't collect job output (#15365)
# Description

Fixes #15359.

# User-Facing Changes

Bug fix.
2025-03-20 09:49:12 -04:00
zc he
2c1d261cca
fix(explore): do not create extra layer for empty entries (#15367)
Fixes #15329

# Description

Stops entering empty list/record with the following message:

<img width="283" alt="image"
src="https://github.com/user-attachments/assets/99cf5ab0-7fd3-4cf7-9db9-00554815a2a7"
/>

# User-Facing Changes

# Tests + Formatting

+5, all vibe coded.

# After Submitting
2025-03-20 06:53:06 -05:00
132ikl
69d1c8e948
Add compile-time assertion of Value's size (#15362)
# Description

Adds an assertion of `Value`'s size, similar to `Instruction` and
`Expr`.
2025-03-20 02:59:06 +00:00
Yash Thakur
2c7ab6e898
Bump to 0.103.1 dev version (#15347)
# Description

Marks development or hotfix
2025-03-19 00:12:01 -04:00
Yash Thakur
c986426478
Bump version for 0.103.0 release (#15340) 2025-03-18 20:12:52 -04:00
Yash Thakur
09674a0026
Feature-gate job unfreeze behind "os" (#15339)
# Description

The `job unfreeze` command relies on the `os` feature of the
`nu-protocol` crate, which means that `nu-command` doesn't compile with
`--no-default-features`. This PR gates `job unfreeze` behind
`nu-command`'s `os` feature to avoid this.

No user-facing changes, no tests needed.
2025-03-18 19:02:04 -04:00
132ikl
4cb195a998
Disallow DTD by default in from xml (#15325)
# Description


Follow-up to #15272, changing default to disallow DTD as discussed.
Especially applicable for the `http get` case.

# User-Facing Changes

Changes behavior introduced in #15272, so release notes need to be
updated to reflect this
2025-03-17 14:16:17 +01:00
Justin Ma
f7f09292d6
Add category to pwd and banner commands (#15330)
<!--
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 category to `pwd` and `banner` commands, fix broken of command docs
updating here:
https://github.com/nushell/nushell.github.io/actions/runs/13884819349/job/38848104064#step:5:18
The error was caused by these two commands have no category
2025-03-17 20:22:01 +08:00
zc he
2c35e07c2d
fix(lsp): ansi strip on hover text (#15331)
Fixes messed ansi escapes in hover text (manpage):

<img width="392" alt="image"
src="https://github.com/user-attachments/assets/37c16520-d499-4079-93d9-0eccd1cfa8de"
/>

# Description

That bug is introduced in #15115.

Also refactored the hover related code to a separate file, just like
other features.

# User-Facing Changes

# Tests + Formatting

# After Submitting
2025-03-17 06:54:48 -05:00
Ian Manske
c949d2e893
into string should not modify strings (#15320)
# Description

`into string` should not modify input strings (even with the
`--group-digits` flag). It's a conversion command, not a formatting
command.

# User-Facing Changes

- For strings, the same behavior from 0.102.0 is preserved.
- Errors are no longer turned into strings, but rather they are returned
as is.

# After Submitting

Create a `format int` and/or `format float` command and so that the
`--group-digits` flag can be transferred to one of those commands.
2025-03-16 20:11:05 +00:00
132ikl
83de8560ee
Unify closure serializing logic for to nuon, to msgpack, and to json (#15285)
# Description
Before this PR, `to msgpack`/`to msgpackz` and `to json` serialize
closures as `nil`/`null` respectively, when the `--serialize` option
isn't passed. This PR makes it an error to serialize closures to msgpack
or JSON without the `--serialize` flag, which is the behavior of `to
nuon`.

This PR also adds the `--serialize` flag to `to msgpack`.

This PR also changes `to nuon` and `to json` to return an error if they
cannot find the block contents of a closure, rather than serializing an
empty string or an error string, respectively. This behavior is
replicated for `to msgpack`.

It also changes `to nuon`'s error message for serializing closures
without `--serialize` to be the same as the new errors for `to json` and
`to msgpack`.

# User-Facing Changes

* Add `--serialize` flag to `to msgpack`, similar to the `--serialize`
flag for `to nuon` and `to json`.
* Serializing closures to JSON or msgpack without `--serialize`

Partially fixes #11738
2025-03-16 20:15:02 +01:00
Stefan Holderbach
1dd861b10f
Close find handle in ls windows unsafe code (#15314)
While inspecting the Windows specific code of `ls` for #15311 I stumbled
upon an unrelated issue in the alternate metadata gathering on Windows
(added by #5703).

The handle created by performing `FindFirstFileW` was never closed,
leading to a potential leak. Fixed by running `FindClose` as soon as the
operation succeeds.

https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findfirstfilew#remarks
2025-03-16 16:33:36 +01:00
Darren Schroeder
42aa2ff5ba
remove mimalloc allocator (#15317)
# Description

This PR removes the mimalloc allocator due to run-away memory leaks
recently found.

closes #15311

# 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.
-->
2025-03-15 09:32:55 -05:00