Skip to content

Construct cell paths programmatically #7337

@kubouch

Description

@kubouch

Related problem

It is currently impossible to update/insert/upsert a nested path from a variable:

let p = 'ls.use_ls_colors'
$env.config | upsert $p false

Nushell treats $p as a string and instead of setting $env.config.ls.use_ls_colors, it ads a new entry $env.config.'ls.use_ls_colors'. This is also a bug because you shouldn't be allowed to have . as a column name.

Describe the solution you'd like

  1. IMO, the first parameter to update/insert/upsert (and possibly other relevant commands) should auto-convert the string into a nested cell paths.
  2. Another option would be to add into cell-path command that would do the same, and you'd have to call upsert ($p | into cell-path) false.

The options are not mutually exclusive. Either way, the bug that . can appear as a column name should be fixed.

Describe alternatives you've considered

No response

Additional context and details

key value
version 0.72.1
branch main
commit_hash 850ecf6
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.65.0 (897e37553 2022-11-02)
rust_channel 1.65.0-x86_64-unknown-linux-gnu
cargo_version cargo 1.65.0 (4bc8f24d3 2022-10-20)
pkg_version 0.72.1
build_time 2022-12-03 12:09:09 +02:00
build_rust_channel release
features database, dataframe, default, trash, which, zip
installed_plugins gstat

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions