You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature: extend nth to take multiple arguments #878
Right now nth lets you select a single row to return. I was thinking it would be handy to extend nth to work more like pick. The pick command lets you pick the columns you want, we could let you pick the rows (rather than a single row) that you want with nth.
@jonathandturner I was playing around with creating a range command where the user could express something like ls | range 3 6 instead of ls | skip 3 | first 7 (I'm thinking this would be inclusive or have a flag to control that behavior). Would this be better included in the nth command where the user writes ls | nth 3 6 --range ?
It might be awkward to interpret when you have > 2 parameters as shown in your example.
@notryanb - I wonder if we might want to update the parser to support ranges. I think something like: ls | nth 3..6 would read a bit better and also let you pass multiple ranges more easily.
I think a range type would be a better solution from a UI perspective.
One of the issue I ran up against was error handling, which would be nice to handle at the parser level instead of in the command/plugin. This way we wouldn't have to keep re-implementing checks for negative ranges.
It also might be interesting to express a command like ls | nth 2..5 7..13 16..20 if we had a range type.
Activity
andrasio commentedon Nov 2, 2019
#900
notryanb commentedon Nov 3, 2019
@jonathandturner I was playing around with creating a
rangecommand where the user could express something likels | range 3 6instead ofls | skip 3 | first 7(I'm thinking this would be inclusive or have a flag to control that behavior). Would this be better included in thenthcommand where the user writesls | nth 3 6 --range?It might be awkward to interpret when you have > 2 parameters as shown in your example.
sophiajt commentedon Nov 3, 2019
@notryanb - I wonder if we might want to update the parser to support ranges. I think something like:
ls | nth 3..6would read a bit better and also let you pass multiple ranges more easily.cc @wycats for thoughts on parsing
notryanb commentedon Nov 3, 2019
I think a range type would be a better solution from a UI perspective.
One of the issue I ran up against was error handling, which would be nice to handle at the parser level instead of in the command/plugin. This way we wouldn't have to keep re-implementing checks for negative ranges.
It also might be interesting to express a command like
ls | nth 2..5 7..13 16..20if we had a range type.Update 3rd_Party_Prompts.md (nushell#878)
Update 3rd_Party_Prompts.md (#878)
Update dataframe examples (nushell#878)