foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.33k stars 1.76k forks source link

Add a way to distinguish whether the user explicitly ran `forge build` or it is part of a process like `forge test` #9340

Closed mgiagante closed 3 days ago

mgiagante commented 3 days ago

Component

Forge

Describe the feature you would like

Referring to https://github.com/foundry-rs/foundry/pull/9325#issuecomment-2482602927

Sometimes, it's useful to be able to act based on whether the subcommand was explicitly called, or it triggered as part of another process.

For instance, when running forge test, this triggers forge build but the user didn't explicitly run it.

In the case above, this would be useful to adjust the output of the command, since a low verbosity like -v might be ok if forge build was explicitly called, but a higher level like -vvvvv would be more suitable for when the output is triggered by forge test.

Additional context

No response

grandizzy commented 3 days ago

I think we already have this https://github.com/foundry-rs/foundry/blob/44c86e76d5e37505cd7349a867e64a845b5b9b2d/crates/forge/bin/main.rs#L137-L153

zerosnacks commented 3 days ago

Hi @mgiagante thanks for opening this, I'll convert this ticket into a note in the https://github.com/foundry-rs/foundry/issues/8794 meta-ticket