Repository navigation
Closed
Description
ls | select name
let column_name = "name"; ls | select $column_name => this will not work. expected column path, found string
ls | get $(= name). => This will not work either
There's no way to convert a string to a column path. This makes it very difficult to manipulate a table from a script.
> version | pivot
───┬────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────
# │ Column0 │ Column1
───┼────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────
0 │ version │ 0.25.1
1 │ build_os │ macos-x86_64
2 │ rust_version │ rustc 1.48.0
3 │ cargo_version │ cargo 1.48.0
4 │ pkg_version │ 0.25.1
5 │ build_time │ 2021-01-06 16:50:40
6 │ build_rust_channel │ release
7 │ features │ ctrlc, default, directories, dirs, git, ichwh, ptree, rich-benchmark, rustyline, term, uuid, which, zip
───┴────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────
Metadata
Metadata
Assignees
Labels
No labels
Activity
kubouch commentedon Jan 28, 2021
I remember running into this earlier, but now it seems to work in 0.26.0 (latest main, commit d0a2a02).
djvsrose commentedon Jan 29, 2021
I just tried in 0.26.0 and I don't think this is fixed.
kubouch commentedon Jan 29, 2021
How about this:
let column_name = "size"; ls -a | sort-by $column_name. This works for me on Linux. (I chose sorting by size since ls is by default sorted by name.)In your second example, you're missing spaces around
=which throws an error.djvsrose commentedon Feb 1, 2021
Yes, the 2nd example is bad. I will update the example. Thanks.
andrasio commentedon Feb 7, 2021
Fixed. Thanks for reporting it!
hustcer commentedon Aug 4, 2021
Help! I still get this issue, and my nu version:
hustcer commentedon Aug 4, 2021
Are you sure it was fixed ?
hustcer commentedon Aug 4, 2021
@andrasio
let column_name = "name"; ls | select $column_nameandlet column_name = "name"; ls | get $column_namedidn't work butlet column_name = "name"; ls | sort-by $column_nameworksandrasio commentedon Aug 4, 2021
@hustcer A regression was introduced (on purpose, sort of). We are thinking how to effectively do this by means of cohesion's instead.
Can you confirm
let column_name = "name"; ls | select $column_name and let column_name = "name"; ls | get $column_namethese no longer work?hustcer commentedon Aug 5, 2021
@andrasio Yes, it's confirmed.
hustcer commentedon Sep 28, 2021
@andrasio Any plan for this? Thx
alechp commentedon Oct 15, 2021
I'm having a similar issue (resolved, fix appended on this comment)
Objective
Static Column (works)
)
String/dynamic Column (fails)
Update 10/15/2021 12:37PM PST
This works:
Convo for context:

fdncred commentedon Oct 15, 2021
ya, i'm closing this because
into column_pathfixes the issue.