Skip to content

Add --strict flag to first and last command, to raise error on empty list.#17066

Merged
WindSoilder merged 1 commit intonushell:mainfrom
WindSoilder:strict_mode
Nov 24, 2025
Merged

Add --strict flag to first and last command, to raise error on empty list.#17066
WindSoilder merged 1 commit intonushell:mainfrom
WindSoilder:strict_mode

Conversation

@WindSoilder
Copy link
Copy Markdown
Contributor

As title, this pr adds --strict flag to first and last command, so they will raise error on empty list. This is a follow up to #17054

Release notes summary - What our users need to know

By default, first and last will return null on empty list, this pr is going to add --strict to make it returns on error.

> [] | first --strict
Error: nu::shell::access_beyond_end

  × Row number too large (empty content).
   ╭─[entry #1:1:6]
 1 │ [] | first --strict
   ·      ──┬──
   ·        ╰── index too large (empty content)
   ╰────

Tasks after submitting

NaN

@WindSoilder WindSoilder added notes:additions Include the release notes summary in the "Additions" section A:commands General additions or changes to commands labels Nov 24, 2025
@WindSoilder WindSoilder merged commit 45ed7f2 into nushell:main Nov 24, 2025
16 checks passed
@github-actions github-actions bot added this to the v0.109.0 milestone Nov 24, 2025
@WindSoilder WindSoilder deleted the strict_mode branch January 29, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A:commands General additions or changes to commands notes:additions Include the release notes summary in the "Additions" section

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant