Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It appears that --jq parameter is not parsed properly #14

Closed
EnriqueSoria opened this issue Oct 24, 2022 · 5 comments · Fixed by #17
Closed

It appears that --jq parameter is not parsed properly #14

EnriqueSoria opened this issue Oct 24, 2022 · 5 comments · Fixed by #17
Assignees
Labels
bug Something isn't working
Milestone

Comments

@EnriqueSoria
Copy link

Description
It appears that jq query is not parsed properly:

when filtering with native jq it works

➜ gh milestone list --state all --first 1 --output json | jq ".[].Title"
"2.38.0"

but with --jq parameter it doesn't

➜ gh milestone list --state all --first 1 --output json --jq ".[].Title"
Usage: gh milestone list [flags]

Flags:
  -f, --first string                          View the first N elements from the list (default "100")
  -h, --help                                  help for list
  -j, --jq string                             Filter JSON output using a jq expression in combination with --output=json
      --orderBy.direction orderBy.direction   Use the defined sorting direction: {asc|desc} (default asc)
      --orderBy.field orderBy.field           Sort the milestones by a field: {created_at|due_date|number|updated_at} (default number)
  -o, --output output                         Decide the output of this command: {json|table} (default table)
  -q, --query string                          View milestones by string pattern
  -s, --state state                           View milestones by their state: {all|closed|open} (default open)

invalid character at position, 0; [

Current behavior

➜ gh milestone list --state all --first 1 --output json --jq ".[].Title"
Usage: gh milestone list [flags]

Flags:
  -f, --first string                          View the first N elements from the list (default "100")
  -h, --help                                  help for list
  -j, --jq string                             Filter JSON output using a jq expression in combination with --output=json
      --orderBy.direction orderBy.direction   Use the defined sorting direction: {asc|desc} (default asc)
      --orderBy.field orderBy.field           Sort the milestones by a field: {created_at|due_date|number|updated_at} (default number)
  -o, --output output                         Decide the output of this command: {json|table} (default table)
  -q, --query string                          View milestones by string pattern
  -s, --state state                           View milestones by their state: {all|closed|open} (default open)

invalid character at position, 0; [

Expected behavior

➜ gh milestone list --state all --first 1 --output json --jq ".[].Title"
"3.75.0"

Environment:

  • OS: Ubuntu 20.04.5 LTS
  • Shell: zsh 5.8 (x86_64-ubuntu-linux-gnu)
@EnriqueSoria EnriqueSoria added the bug Something isn't working label Oct 24, 2022
@valeriobelli
Copy link
Owner

valeriobelli commented Oct 24, 2022

Hey @EnriqueSoria 👋🏽

Thanks for having reported this weird behaviour. The culprit is the vendor https://github.com/savaki/jq this extension uses, as stated by savaki/jq#7 and savaki/jq#2.

I'm going to fix it ASAP.

@valeriobelli valeriobelli self-assigned this Oct 24, 2022
@valeriobelli valeriobelli added this to the v2.0.0 milestone Oct 25, 2022
@EnriqueSoria
Copy link
Author

Wow, that was a really quick fix! Thanks ❤️!

@valeriobelli
Copy link
Owner

I would group this other enhancement #16 in the same release since both have breaking changes.

@EnriqueSoria, is this bug blocking you from going forward by any means?

@EnriqueSoria
Copy link
Author

I would group this other enhancement #16 in the same release since both have breaking changes.

@EnriqueSoria, is this bug blocking you from going forward by any means?

@valeriobelli For me it's not critical, I was just appreciating how fast you answered and fixed this. Thanks again for your interest!

@valeriobelli
Copy link
Owner

I'll try to schedule a release by the end of this week, including the other enhancement I mentioned. If I fail to accomplish that enhancement, I'll release only the fix for this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants