-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[cli] format output of sui client gas
to a well formatted table
#13852
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the well-formatted table purely for aesthetic reasons or are there other benefits to this?
crates/sui/src/client_commands.rs
Outdated
table.with(TableStyle::rounded().horizontals([ | ||
HorizontalLine::new(1, TableStyle::modern().get_horizontal()), | ||
HorizontalLine::new(2, TableStyle::modern().get_horizontal()), | ||
HorizontalLine::new(gases.len() + 2, TableStyle::modern().get_horizontal()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the gases.len() + 2 for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will draw a line between the last item (that has a coin value) in the table and the footer, similarly as it is done for the header. the +2 is due to the fact that there are two rows in the beginning: header text + header with column names. If you take a look at the screenshots, you can see these three horizontal lines that are defined there.
Thanks Will for the review and for your thoughtful questions! I'll try to explain my reasoning here. In my view, there are two reasons:
Before change
After this change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat!
sui client gas
to a well formatted table
Output looks great @stefan-mysten , thanks! Before you land, can you update the Release Notes to mention the breaking change to the JSON format? (i.e. if someone was using |
6f5812a
to
87b3829
Compare
87b3829
to
02b3112
Compare
Good point! I revisited the naming and settled on |
02b3112
to
a8482d9
Compare
Description
This PR displays the output of
sui client gas [address]
as a well formatted table. If there are more than 10 coins, it will add an extra header and footer with the number of coins.Test Plan
Found an address with lots of coins on devnet
![image](https://private-user-images.githubusercontent.com/135084671/269413667-361415ff-0418-4f9a-a77d-1c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BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxM1QxNzUyNTNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05NzdmN2FiN2U5Mjk3NGZkNzJkMzAxOTJkMDNhYmI5MjZiNmIzMmY1YmZlZDA5YmQ0ODIxNDE1ZjM1ZmEwNGI5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.E8SJk7FhRSnyBiONEDIc40kcgEnGRQVrcsmKFBfH95M)
If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.
Type of Change (Check all that apply)
sui client gas
command's JSON outputRelease notes
This PR changes the output of
sui client gas [address]
to a well-formatted table. This breaks the previous JSON format, when using--json
flag, due to changing theGasCoin
output type to a simpler one. For example, you might have previously accessed the gas coin ID usingid.id
and the value usingbalance.value
from the original JSON, as in the following example:With this change, now you must use
gasCoinId
to access the ID andgasBalance
for the balance vlaue. The JSON output now resembles the following: