-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New optional cell-path make use of variables harder #8480
Copy link
Copy link
Closed
Labels
category:enhancementNew feature or requestNew feature or request
Milestone
Description
Related problem
This is related to the merged unreleased MR 8379
Previous to this change i could do the following:
$ let b = "b"
$ {"a": 1} | get -i $b
With this change i cant find a way (expect for using a try-block) to do this:
$ let b = "b"
$ {"a": 1} | get $b?
Error: nu::parser::parse_mismatch
× Parse mismatch during operation.
╭─[entry #3:1:1]
1 │ {"a": 1} | get $b?
· ┬
· ╰── expected .
╰────
$ {"a": 1} | get ($b)?
Error: nu::parser::parse_mismatch
× Parse mismatch during operation.
╭─[entry #5:1:1]
1 │ {"a": 1} | get ($b)?
· ┬
· ╰── expected .
╰────
$ {"a": 1} | get $"($b)"?
Error: nu::shell::column_not_found
× Cannot find column
╭─[entry #17:1:1]
1 │ {"a": 1} | get $"($b)"?
· ────┬─── ────┬───
· │ ╰── cannot find column 'b"?'
· ╰── value originates here
╰────
Describe the solution you'd like
I would appreciate it if one of the following would work:
get $b?get ($b)?
Describe alternatives you've considered
{"a": 1} | try {get ($b)} catch {null} works, but is a bit chunky in my opinion.
Additional context and details
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
category:enhancementNew feature or requestNew feature or request