Skip to content

Improvements to label list #5489

Description

@heaths

Based on comments, I think there's a few improvements we should make to label list:

  • Do not limit results by default. There seems to be no customer value unless they explicitly want to limit results.

    To clarify, it is used as the page size and does support paging, but lines 67-69 of this block of code should be removed:

    for _, label := range response.Repository.Labels.Nodes {
    labels = append(labels, label)
    if len(labels) == limit {
    break loop
    }
    }

  • One reason they might want to limit results is to filter the list, much like you can filter issues or PRs. Like heaths/gh-label we could either tag an optional argument for the filter term, or a --search parameter like issue list has for consistency. The former would only be breaking if someone actually expected an error with an additional arg, but that seems like an impractical test. The latter would be consistent with issue list and pr list, however.

  • Sort results by default. A large list of unsorted labels is difficult to read and find what you want. The order returned is also not documented and should not be relied on.

Activity

  1. heaths commented on Apr 20, 2022

    @heaths
    ContributorAuthor

    On a related note, should at least a label remove command as well. A label edit might also be useful, but a label create --force will accomplish the same thing.

  2. samcoe commented on Apr 21, 2022

    @samcoe
    Contributor

    I responded inline regarding these proposals, so I will just briefly summarize here.

    • I am not convinced that removing the default limit is the right direction for a couple reasons.

    • I am onboard with adding --order and --search flags with functionality that is backed by the API. Adding this functionality makes the default limit more valuable IMO.

    • The labels are ordered by created at date when returned from the API.

    • A label remove command makes sense to me but label edit seems redundant with label create --force. Perhaps that is okay though since label edit is more discoverable and explicit.

  3. Griffin641498 commented on Apr 22, 2022

    @Griffin641498
  4. heaths commented on Apr 22, 2022

    @heaths
    ContributorAuthor

    @samcoe I've got this nearly finished, but found a bug with the LabelConnection GraphQL type: if you specify a query, the orderBy has no effect. I can work around this, but would be great to see a fix for GraphQL.

  5. added
    enhancementa request to improve CLI
    and removed on Apr 22, 2022
  6. added a commit that references this issue on Apr 22, 2022
    7ffd5b9
  7. heaths commented on Apr 22, 2022

    @heaths
    ContributorAuthor

    I've got this done but waiting for #5452 so I can rebase it onto trunk and submit a clean PR.

  8. added 2 commits that reference this issue on Apr 25, 2022
    5ea4597
    45cbc9b
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

    enhancementa request to improve CLIhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions