Skip to content

Take update cells columns as rest arguments and deprecate --columns - #19125

Merged
fdncred merged 4 commits into
nushell:mainfrom
Shub3am:update-cells-rest-columns
Oct 21, 2026
Merged

fdncred merged 4 commits into
nushell:mainfrom
Shub3am:update-cells-rest-columns

Conversation

@Shub3am

@Shub3am Shub3am commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

update cells now takes the columns to update as rest arguments, and --columns is deprecated. That's the direction agreed in #15477 and matches select, reject and the into commands.

This picks up #17815, which was closed because the author stopped responding (credit to @tauanbinato for the original change). I rebased the idea onto current main, which also has --recursive now, and made the follow-up changes @fdncred asked for there:

  • the two update cells -c [...] calls in crates/nu-std/tests/test_std-rfc_tables.nu now use rest arguments
  • the open test in crates/nu-command/tests/commands/open.rs already uses no -c, so it didn't need a change

A couple of details:

  • --columns still works and shows the deprecation warning on first use. If someone passes both, the two lists are merged.
  • -c [] still means "update no columns", and an empty spread like ...$cols with $cols = [] means the same. Only calling it with no flag and no columns at all updates everything, same as before.
  • The rest parameter is named rest, like select and reject, so it doesn't share a name with the deprecated --columns flag.
  • Rest columns go through the same string coercion as -c, so int column names work either way (let cols = [1]; {"1": 1} | update cells { $in + 1 } ...$cols).
  • The deprecation since is 0.117.0, since 0.116.0 shipped without it.

Checked with a local build:

> {a: 1, b: 2, c: 3} | update cells { $in + 10 } a c | to nuon
{a: 11, b: 2, c: 13}
> {a: 1, b: 2, c: 3} | update cells -c [a] { $in + 10 } | to nuon   # warns once, still works
{a: 11, b: 2, c: 3}
> {a: 1, b: 2, c: 3} | update cells -c [] { $in + 10 } | to nuon
{a: 1, b: 2, c: 3}
> {a: 1, b: 2, c: 3} | update cells -c [a] { $in + 10 } c | to nuon
{a: 11, b: 2, c: 13}
> let cols = []; {a: 1, b: 2, c: 3} | update cells { $in + 10 } ...$cols | to nuon
{a: 1, b: 2, c: 3}
> let cols = [1]; {"1": 1, b: 2} | update cells { $in + 1 } ...$cols | to nuon
{"1": 2, b: 2}

The converted example fails on main with ExtraPositional and passes here. The new tests in crates/nu-cmd-extra/tests/commands/filters/update_cells.rs cover --columns, merging it with rest columns, empty column lists and int column names. cargo fmt --all -- --check, cargo clippy -p nu-cmd-extra --all-targets -- -D warnings, cargo test -p nu-cmd-extra and the std test suite (testing run-tests --path crates/nu-std, 251 tests) all pass.

User-facing changes (Release notes)

Pass column names directly to update cells

update cells now accepts column names as rest arguments, matching select, reject, and the into commands. The --columns (-c) flag is deprecated but still works, with a warning on first use. Replace the flag and list with column names after the closure:

# before
[[name val1 val2]; [foo 1 4] [bar 8 3]] | update cells -c [val1 val2] { $in * 2 }
# after
[[name val1 val2]; [foo 1 4] [bar 8 3]] | update cells { $in * 2 } val1 val2

Additional notes

closes #15477

@github-actions github-actions Bot added the A:std-library Defining and improving the standard library written in Nu label Sep 30, 2026

@fdncred fdncred left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review overview

🟡 Changes recommended

Moving -c $cols to ...$cols, as the deprecation help says to, changes what an empty list does, and the deprecation names a release that already shipped without it.

Findings: 1 High severity · 2 Medium severity · 2 Low severity

Open (5)

Notes from my clanker, checked on fe3812c. The PR applies cleanly onto main at 430207e. I built nu from that and ran the commands quoted in the comments against it.

…mns in update cells

An empty spread like `...[]` now updates no columns, the same as `-c []`. Rest columns go through the same string coercion as the flag, so int column names work either way. The rest parameter is renamed to `rest` and the deprecation is marked as 0.117.0.
Cover the deprecated --columns flag, merging it with rest columns, empty column lists and int column names.
@Shub3am
Shub3am force-pushed the update-cells-rest-columns branch from fe3812c to 4ccf95f Compare October 21, 2026 11:13
@Shub3am

Shub3am commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

@fdncred thanks for the review, all five points are addressed (a788405 for the fixes, 4ccf95f for the new tests), and the branch is rebased on current main.

@fdncred fdncred added notes:breaking-changes Noted in Breaking Changes section notes:ready Indicates Ready for Release notes and removed A:std-library Defining and improving the standard library written in Nu labels Oct 21, 2026
@fdncred
fdncred merged commit 9a44541 into nushell:main Oct 21, 2026
11 checks passed
@fdncred

fdncred commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Thanks

@github-actions github-actions Bot added this to the v0.117.0 milestone Oct 21, 2026
@tauanbinato

Copy link
Copy Markdown
Contributor

Thanks for the credits, i was very busy with other work could not continue, nice work

fdncred pushed a commit to nushell/nu_scripts that referenced this pull request Nov 12, 2026
`update cells --columns` is deprecated in Nushell 0.117.0 in favor of
columns as rest arguments (nushell/nushell#19125).

This updates `gh my stars` to `update cells { $in | into datetime }
starredAt`.

Tested with nu 0.117.0: `gh my stars` runs with no deprecation warning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:breaking-changes Noted in Breaking Changes section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change columns flag of update cells into a rest argument

3 participants