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: output status in JSON #34

Merged
merged 2 commits into from
Apr 4, 2023
Merged

feat: output status in JSON #34

merged 2 commits into from
Apr 4, 2023

Conversation

YDX-2147483647
Copy link
Contributor

I want to use bitsrun status in a shell script, and a JSON output would simplify things.


JSON allows for more structure than plain text, so it makes it much easier to output and handle complex data structures. jq is a common tool for working with JSON on the command-line, and there is now a whole ecosystem of tools that output and manipulate JSON.

It is also widely used on the web, so by using JSON as the input and output of programs, you can pipe directly to and from web services using curl.

(copied from clig.dev)

@spencerwooo spencerwooo added the enhancement New feature or request label Apr 2, 2023
@spencerwooo
Copy link
Member

Agreed. I would suggest an additional argument --json, where for each option, bitsrun would output the response in JSON format. (Implemented as a click flag option.)

@YDX-2147483647
Copy link
Contributor Author

YDX-2147483647 commented Apr 2, 2023

bitsrun status --json is implemented as a boolean flag of status sub-command in this PR.

I don't think bitsrun login/logout --json makes sense. It's an action, $? is enough. (login/logout are verbs, and status is a noun.)

@spencerwooo
Copy link
Member

Oh god I'm so sorry, I thought this was an issue instead of a PR. I'll review this tomorrow!

Copy link
Member

@spencerwooo spencerwooo left a comment

Choose a reason for hiding this comment

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

Approved. 👍

@spencerwooo spencerwooo merged commit 200b6a3 into BITNP:main Apr 4, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants