Skip to content

Feature: extend nth to take multiple arguments #878

Closed

Description

@sophiajt

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.

Eg) ls | nth 1 2 5

Activity

  1. added
    good first issue
    category:enhancement
    on Oct 31, 2019
  2. andrasio commented on Nov 2, 2019

    @andrasio
    Member
  3. notryanb commented on Nov 3, 2019

    @notryanb
    Contributor

    @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.

  4. sophiajt commented on Nov 3, 2019

    @sophiajt
    ContributorAuthor

    @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.

    cc @wycats for thoughts on parsing

  5. notryanb commented on Nov 3, 2019

    @notryanb
    Contributor

    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.

  6. added a commit that references this issue on Feb 7, 2022
  7. added a commit that references this issue on Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:enhancementgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions