valeriobelli / gh-milestone

GitHub CLI extension for managing Milestones
MIT License
54 stars 2 forks source link

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

Closed EnriqueSoria closed 2 years ago

EnriqueSoria commented 2 years ago

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:

valeriobelli commented 2 years ago

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 https://github.com/savaki/jq/issues/7 and https://github.com/savaki/jq/issues/2.

I'm going to fix it ASAP.

EnriqueSoria commented 2 years ago

Wow, that was a really quick fix! Thanks :heart:!

valeriobelli commented 2 years ago

I would group this other enhancement https://github.com/valeriobelli/gh-milestone/issues/16 in the same release since both have breaking changes.

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

EnriqueSoria commented 2 years ago

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 commented 2 years ago

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.