Kumar Ujjawal 179ea5ae87
fix(which): remove required positional argument to allow spread input (#15870)
## Summary

This PR removes the required positional argument from the `which`
command, allowing it to accept input via the spread (`...`) operator.
This enables expressions like:

```nu
[notepad cmd] | which ...$in
```

Previously, this failed due to a missing required positional argument.
The Nushell runtime already handles empty input gracefully, so the
change aligns with existing behavior.

---

## Motivation

Making `which` compatible with splatted input improves composability and
aligns with user expectations in scriptable environments. It supports
patterns where the input may be constructed dynamically or piped in from
earlier commands.

---

## Changes

* Removed the `required` attribute from the positional argument in the
`which` command signature.
* No additional runtime logic required since empty input is handled
gracefully already.

---

## Examples

### Before

```nu
[notepad cmd] | which ...$in
#  Error: Missing required positional argument
```

### After

```nu
[notepad cmd] | which ...$in
#  Executes correctly
```

---

## Testing

* Ran `cargo test --all` and `cargo test -p nu-command`
* Manually tested using spread input with the `which` command
* Confirmed that empty and non-empty inputs behave correctly

---

## Related Issues

Closes
[[#15801](https://github.com/nushell/nushell/issues/15801)](https://github.com/nushell/nushell/issues/15801)

---------

Co-authored-by: Kumar Ujjawal <kumar.ujjawal@greenpista.com>
2025-06-02 20:18:02 +02:00
..
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2022-11-22 16:58:11 -08:00
2025-05-13 16:49:30 +02:00
2025-02-10 15:32:05 +08:00
2024-05-23 02:05:27 +00:00
2024-05-23 02:05:27 +00:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2023-10-24 12:48:05 -05:00
2025-05-13 16:49:30 +02:00
2025-04-01 07:17:05 -05:00
2025-05-13 16:49:30 +02:00
2024-10-11 06:43:12 -05:00
2025-02-06 06:56:30 -06:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2025-06-01 19:21:07 +03:00
2025-01-04 16:41:03 -05:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2025-04-26 23:24:35 +08:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2024-12-18 06:36:04 -06:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2023-04-28 13:25:44 +02:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2023-04-28 13:25:44 +02:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2024-05-03 08:36:10 +08:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00
2025-05-13 16:49:30 +02:00