Repository navigation
Deprecate --columns flag in update cells in favor of rest arguments - #17815
Closed
tauanbinato wants to merge 2 commits into
Closed
tauanbinato wants to merge 2 commits into
tauanbinato wants to merge 2 commits into
Conversation
Contributor
|
Can you search the repo for
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #15477
update cellsfor specifying columns to update, matching the pattern used byintocommands and other filters--columns(-c) flag viadeprecation_info(), following the same pattern asselect,reject, andget--columnsflag still works for backward compatibility but emits a deprecation warningBefore
After
New examples
Release notes summary
update cellsnow accepts column names as rest arguments instead of requiring the--columnsflag. The--columnsflag is deprecated and will be removed in a future release.