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: support stdin in cast 4byte-decode #2080

Merged
merged 1 commit into from
Jun 22, 2022
Merged

Conversation

onbjerg
Copy link
Member

@onbjerg onbjerg commented Jun 22, 2022

Closes #2077

$ ./target/local/cast tx 0x8ee80b1fdc814a71aaf11d01b4409c37de43e48b2221251d625d123df221098f --json | jq -r .input | ./target/local/cast 4byte-decode
1) "mint(uint256,bytes)"
1655145740
0xe26b098c2e13597b890be3e99cd4d77d2d2ac222d4097a3c6e3109b8214f53862ee444293619012a112d647143ff8f178983b663db20d7a98c6a0d2bca56150e

@onbjerg onbjerg added the T-feature Type: feature label Jun 22, 2022
@shekhirin
Copy link
Contributor

What I don't really like about that approach with unwrap_or_stdin is that if you call such commands without arguments, they just hang and don't display any help. It'd be cool to use something like atty like it's done in formatter:

let inputs = if root == PathBuf::from("-") || !atty::is(atty::Stream::Stdin) {

@mattsse
Copy link
Member

mattsse commented Jun 22, 2022

What I don't really like about that approach with unwrap_or_stdin is that if you call such commands without arguments, they just hang and don't display any help. It'd be cool to use something like atty like it's done in formatter:

let inputs = if root == PathBuf::from("-") || !atty::is(atty::Stream::Stdin) {

very good point, we should integrate this check in a followup,
a lot of cast commands using unwrap_or_stdin

@onbjerg onbjerg merged commit 3d496a4 into master Jun 22, 2022
@onbjerg onbjerg deleted the onbjerg/cast-4byte-stdin branch June 22, 2022 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accept stdin to cast 4byte-decode
3 participants