-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
chore(Cast): improve ether_core cli printing #1193 #1253
Conversation
5a0241c
to
c3bfd50
Compare
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.
thanks,
couple nits :)
cast/src/lib.rs
Outdated
if field_value.is_some() { | ||
field_value.unwrap() |
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.
use if let Some() = .. {}
here
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.
updated!
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.
Nits as well, looks great otherwise! Thank you.
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.
thanks for this
lgtm
@Bind can you please run |
On it |
I think that |
I should be able to handle that. |
Thank you @Bind! This is looking great. Only change needed is the r/s change, otherwise we can go for it |
8158b5c
to
f0447fc
Compare
Alrighty, |
Think my vscode formatOnSave was borking the |
Motivation
cast cli output isn't quite consistent with seth as outlined in issue 1193.
Solution
I've added a simple trait
UIfmt
which has a functionpretty
.pretty
returns the string that represents the underlying value formatted based on its type. Sounds overly complex, I format the string in the trait impl.Most of the code can be found in print_utils
In order to handle similar
field
usage eg.I added get_pretty_<>_attr, which just maps from strings to struct properties. Doesn't seem like there is any easy way to dynamically access struct properties without manually managing a map, but happy to take another stab at it if there is an implementation I can use as a reference.
Didn't want to add a dep, but let me know if there is something you'd like me to pull in to better manage the template strings.
Examples
before:
now:
before:
now:
$ cast block latest
before | now