foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Improve forge `script` `--json` output and handling of `--silent`

Open zerosnacks opened this issue 1 year ago • 0 comments

Component

Forge

Describe the feature you would like

Currently when passing the --json flag the following is returned:

https://github.com/foundry-rs/foundry/blob/f0d9eeced8ec01045b2849ea2cc3c72773282d70/crates/script/src/lib.rs#L496-L501

It would be beneficial to return more information, as defined by ScriptResult

https://github.com/foundry-rs/foundry/blob/f0d9eeced8ec01045b2849ea2cc3c72773282d70/crates/script/src/lib.rs#L462-L474

In turn it would also be useful to define a JSON schema for the output (https://github.com/foundry-rs/foundry/issues/7813)

I've also noticed that alongside the JSON a lot of other lines are written to stdout making it difficult to cleanly capture the output. If --silent is passed and the --json flag is enabled only the JSON should be returned. It appears --silent is currently only applied to the compilation output during the build phase.

Additional context

No response

zerosnacks avatar Apr 30 '24 08:04 zerosnacks