Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Make cli commands support emitting JSON #7827

Closed
xtrapower opened this issue Jan 15, 2020 · 9 comments · Fixed by #9478
Closed

Make cli commands support emitting JSON #7827

xtrapower opened this issue Jan 15, 2020 · 9 comments · Fixed by #9478
Assignees
Milestone

Comments

@xtrapower
Copy link

Problem

We have been working on a Solana validator dashboard . To offer more insights we would like to integrate information provided by cli commands like solana validator-info get and solana show-block-production. It would be extremely helpful if cli commands would support emitting JSON.

Proposed Solution

Add a --json flag to cli commands that allow programmatic access by outputting JSON.

@garious
Copy link
Contributor

garious commented Jan 15, 2020

How about using curl and the JSON RPC APIs? https://docs.solana.com/book/api-reference/jsonrpc-api

@xtrapower
Copy link
Author

xtrapower commented Jan 16, 2020

@garious We already pull out everything we can via JSON RPC but there are quite a few methods only available via cli such as solana validator-info get and solana show-block-production. Adding more methods to the JSON RPC would be another solution! We are especially interested in those two methods.

@garious garious added this to the The Future! milestone Jan 16, 2020
@garious
Copy link
Contributor

garious commented Jan 16, 2020

Okay, I see that those commands do a fair amount of client-side processing that you wouldn't want to duplicate.

@CriesofCarrots, want this one?

@CriesofCarrots
Copy link
Contributor

want this one?

Heck yeah, I do! @garious

@CriesofCarrots CriesofCarrots self-assigned this Jan 16, 2020
@xtrapower
Copy link
Author

@CriesofCarrots Hi there, is this still upcoming? As mainnet approaches this would help a great deal in extracting information from local nodes programmatically. Thanks!

@CriesofCarrots
Copy link
Contributor

@xtrapower , thanks for following up! This got shelved for a bit, but I am going to see if I can squeeze it in sometime in the next week or so.

@xtrapower
Copy link
Author

@CriesofCarrots Sorry to bother you, I'm just checking in to see when you might find the time to implement this? Thanks!

@CriesofCarrots
Copy link
Contributor

@xtrapower , I actually played around with this a little this weekend. If this week isn't too crazy, I should be able to get something landed in the next couple days.

@CriesofCarrots
Copy link
Contributor

CriesofCarrots commented Apr 14, 2020

@xtrapower , this is going in to v1.1 (#9495), so it should be available on testnet after our next patch release, and available on mainnet-beta when we move to v1.1 at the end of the month.

New cli options: --output json (pretty-print) and --output json-compact
The output option doesn't yet affect all subcommands, but does handle the 2 you were interested in, plus all the others that have complex return data or are processing-heavy. Please let me know if you have any feedback.

@mvines mvines modified the milestones: The Future!, v1.2.0 Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants