Skip to content

jq unique produces null from empty arrays #7001

Closed
cli/go-gh
#119

Description

Describe the bug

During a gh pr list with jq filtering, any empty array passed to the unique operator outputs null.

$ gh --version
gh version 2.4.0+dfsg1 (2022-03-23 Ubuntu 2.4.0+dfsg1-2)
https://github.com/cli/cli/releases/latest

Steps to reproduce the behavior

  1. gh pr list --json title -q '[] | unique'
  2. Observe that the output is null

Expected vs actual behavior

Expected output is the empty array ([]). Instead, null is produced.

Logs

$ gh pr list --json title -q '[] | unique'
null

Activity

  1. ghost added
    bug
    on Feb 9, 2023
  2. added
    needs-triage
    on Feb 9, 2023
  3. added
    priority-3
    and removed
    needs-triage
    on Feb 9, 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

    bugpriority-3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions