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

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 opened this issue Nov 18, 2024 · 2 comments
Labels
T-feature Type: feature T-needs-triage Type: this issue needs to be labelled

Comments

@mgiagante
Copy link
Contributor

Component

Forge

Describe the feature you would like

Referring to #9325 (comment)

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
Copy link
Collaborator

I think we already have this

fn init_execution_context(subcommand: &ForgeSubcommand) {
let context = match subcommand {
ForgeSubcommand::Test(_) => ForgeContext::Test,
ForgeSubcommand::Coverage(_) => ForgeContext::Coverage,
ForgeSubcommand::Snapshot(_) => ForgeContext::Snapshot,
ForgeSubcommand::Script(cmd) => {
if cmd.broadcast {
ForgeContext::ScriptBroadcast
} else if cmd.resume {
ForgeContext::ScriptResume
} else {
ForgeContext::ScriptDryRun
}
}
_ => ForgeContext::Unknown,
};
set_execution_context(context);

@zerosnacks
Copy link
Member

Hi @mgiagante thanks for opening this, I'll convert this ticket into a note in the #8794 meta-ticket

@zerosnacks zerosnacks closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: feature T-needs-triage Type: this issue needs to be labelled
Projects
Status: Done
Development

No branches or pull requests

3 participants