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

fix: forge script should adhere to --json flag #9404

Merged
merged 13 commits into from
Nov 26, 2024

Conversation

zerosnacks
Copy link
Member

@zerosnacks zerosnacks commented Nov 25, 2024

Motivation

Closes: forge script --json is not clean
Closes: forge script --quiet is not quiet
Closes: #3981

Does not include the verification flow compatibility because the formatting is all over the place and requires some more consideration (around retries, failures, etc..)

Solution

Uses ProgressBar::hidden()

forge script MyScript --broadcast --json > /dev/null

Now returns empty

@zerosnacks zerosnacks self-assigned this Nov 25, 2024
@zerosnacks zerosnacks marked this pull request as ready for review November 26, 2024 10:27
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, have couple of nits re code duplicates that we could avoid

crates/script/src/receipts.rs Outdated Show resolved Hide resolved
crates/script/src/simulate.rs Outdated Show resolved Hide resolved
@zerosnacks zerosnacks requested a review from grandizzy November 26, 2024 14:39
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@zerosnacks zerosnacks enabled auto-merge (squash) November 26, 2024 15:18
@zerosnacks zerosnacks merged commit 0045384 into master Nov 26, 2024
21 checks passed
@zerosnacks zerosnacks deleted the zerosnacks/forge-script-adherence branch November 26, 2024 15:32
rplusq pushed a commit to rplusq/foundry that referenced this pull request Nov 29, 2024
* adhere to --quiet flag

* revert case-specific handling of writing to progress, redundant

* handle writing to multiprogress, previously panic

* make verification process compatible with --json flag

* revert verifaction --json flow, too messy

* clean up

* revert

* handle json correctly for script deployment logs, incl. receipts

* avoid incompatible lines with json output

* revert unnecessary change

* add json and quiet test

* address feedback

* fix incorrect ordering
@grandizzy grandizzy added T-feature Type: feature C-forge Command: forge labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge T-feature Type: feature
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

indicatif progress bars to do not respect output redirecting
2 participants