Solana: Make cli commands support emitting JSON

Created on 15 Jan 2020  路  9Comments  路  Source: solana-labs/solana

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.

Most helpful comment

want this one?

Heck yeah, I do! @garious

All 9 comments

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

@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.

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?

want this one?

Heck yeah, I do! @garious

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

@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.

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

@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.

@xtrapower , this is going in to v1.1 (https://github.com/solana-labs/solana/pull/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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

garious picture garious  路  9Comments

mvines picture mvines  路  7Comments

kwunyeung picture kwunyeung  路  8Comments

aeyakovenko picture aeyakovenko  路  11Comments

ryoqun picture ryoqun  路  10Comments