Skip to content

Deprecate --columns flag in update cells in favor of rest arguments - #17815

Closed
tauanbinato wants to merge 2 commits into
nushell:mainfrom
tauanbinato:fix/15477-update-cells-rest-argument
Closed

tauanbinato wants to merge 2 commits into
nushell:mainfrom
tauanbinato:fix/15477-update-cells-rest-argument

Conversation

@tauanbinato

@tauanbinato tauanbinato commented Mar 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #15477

  • Add rest arguments to update cells for specifying columns to update, matching the pattern used by into commands and other filters
  • Deprecate the --columns (-c) flag via deprecation_info(), following the same pattern as select, reject, and get
  • The old --columns flag still works for backward compatibility but emits a deprecation warning

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

New examples

# Update specific columns in a record
{a: 1, b: 2, c: 3} | update cells { $in + 10 } a c
# => {a: 11, b: 2, c: 13}

Release notes summary

update cells now accepts column names as rest arguments instead of requiring the --columns flag. The --columns flag is deprecated and will be removed in a future release.

@fdncred fdncred added the notes:breaking-changes Noted in Breaking Changes section label Mar 16, 2026
@fdncred fdncred added the notes:ready Indicates Ready for Release notes label Mar 30, 2026
@fdncred

fdncred commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Can you search the repo for update cells and update those items too?

  1. I see 1 test for open
  2. I see 2 test in test_std-rfc_tables.nu

@cptpiepmatz

cptpiepmatz commented Jul 28, 2026 •

Copy link
Copy Markdown
Member

Author did not respond

fdncred pushed a commit that referenced this pull request Oct 21, 2026
…s` (#19125)

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

`update cells` now accepts the columns to update as rest arguments, and
the `--columns` (`-c`) flag is deprecated:

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