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

feat(718): issue view: raw response option #720

Merged
merged 1 commit into from
Apr 6, 2024

Conversation

mpalahuta
Copy link
Contributor

#718

Adding --json flag to the jira issue view <KEY> command so that the tool prints the issue contents as plain JSON if the flag is set. This feature allows users to process the issue information with their programs to support various automation scenarios.

I've added an intermediate struct printableIssue to ensure correct null/empty values in the produced JSON, to avoid zero-values like

{
...
  "assignee": {
    "displayName": ""
  }
...
}

Screenshot 2024-03-14 at 16 29 36

Copy link
Owner

@ankitpokhrel ankitpokhrel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mpalahuta, Thank you for working on this.

I was bit hesitant to support json response but since there are lot of requests for this (and now a PR), I am reconsidering my decision.

Having said that, if we want to go ahead with json response, I think we should send the entire raw json response from the API to the user. That would help us cover most of the usecase reported.

Let me know what you think!

internal/view/issue.go Outdated Show resolved Hide resolved
@mpalahuta
Copy link
Contributor Author

Hey @ankitpokhrel
Thanks a lot for looking into this PR and for the green light on the JSON output - this will be very helpful!

Reg. raw response, sounds great, thanks! I will update this PR on Mon to do exactly that!

@mpalahuta mpalahuta changed the title feat(718): view issue: json output option feat(718): issue view: raw response option Mar 19, 2024
@mpalahuta
Copy link
Contributor Author

hey @ankitpokhrel
I've updated the PR to follow your suggestion of printing the raw API response. Verified on my machine - works as expected.
Please take a look whenever you have a chance, thanks!

Screenshot 2024-03-19 at 18 01 24

@valters
Copy link

valters commented Mar 28, 2024

hi @ankitpokhrel, I am also interested in this improvement. Having this will enable new build/release automation scenarios for us.

Copy link
Owner

@ankitpokhrel ankitpokhrel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thank you 🎉

flagRaw = "raw"
flagDebug = "debug"
flagComments = "comments"
flagPlain = "plain"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for refactoring this 👍🏻

@ankitpokhrel ankitpokhrel merged commit 53a3d56 into ankitpokhrel:main Apr 6, 2024
4 checks passed
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Sep 23, 2024
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ankitpokhrel/jira-cli](https://github.com/ankitpokhrel/jira-cli) | patch | `v1.5.1` -> `v1.5.2` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>ankitpokhrel/jira-cli (ankitpokhrel/jira-cli)</summary>

### [`v1.5.2`](https://github.com/ankitpokhrel/jira-cli/releases/tag/v1.5.2)

[Compare Source](ankitpokhrel/jira-cli@v1.5.1...v1.5.2)

#### What's Changed

-   feat: issue view: Raw response option by [@&#8203;mpalahuta](https://github.com/mpalahuta) in ankitpokhrel/jira-cli#720
-   feat: Add original estimate option to issue creation by [@&#8203;rodcloutier](https://github.com/rodcloutier) in ankitpokhrel/jira-cli#748
-   feat: Allow updating parent on edit by [@&#8203;ankitpokhrel](https://github.com/ankitpokhrel) in ankitpokhrel/jira-cli#765
-   feat: Add cli method for close sprint with supporting jira client … by [@&#8203;cworsnup13](https://github.com/cworsnup13) in ankitpokhrel/jira-cli#756 ankitpokhrel/jira-cli#778
-   fix: Epic description overridden in no-input mode by [@&#8203;ankitpokhrel](https://github.com/ankitpokhrel) in ankitpokhrel/jira-cli#728
-   fix: Regression introduced by new OriginalEstimate attribute by [@&#8203;fabio42](https://github.com/fabio42) in ankitpokhrel/jira-cli#767
-   fix: Consider Windows Terminal as non-dumb terminal by [@&#8203;beatbrot](https://github.com/beatbrot) in ankitpokhrel/jira-cli#706
-   fix: Improve zsh autocomplete directions by [@&#8203;omair-inam](https://github.com/omair-inam) in ankitpokhrel/jira-cli#739

#### New Contributors

-   [@&#8203;mpalahuta](https://github.com/mpalahuta) made their first contribution in ankitpokhrel/jira-cli#720
-   [@&#8203;omair-inam](https://github.com/omair-inam) made their first contribution in ankitpokhrel/jira-cli#739
-   [@&#8203;rodcloutier](https://github.com/rodcloutier) made their first contribution in ankitpokhrel/jira-cli#748
-   [@&#8203;fabio42](https://github.com/fabio42) made their first contribution in ankitpokhrel/jira-cli#767
-   [@&#8203;cworsnup13](https://github.com/cworsnup13) made their first contribution in ankitpokhrel/jira-cli#756

**Full Changelog**: ankitpokhrel/jira-cli@v1.5.1...v1.5.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants