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(common::shell): add global verbosity level (-vvv) flag replacing --verbose #9273

Merged
merged 12 commits into from
Nov 13, 2024

Conversation

zerosnacks
Copy link
Member

@zerosnacks zerosnacks commented Nov 6, 2024

Motivation

In line with the familiar (-v ,-vv, -vvv, etc..) I think it makes sense replace the current global --verbose option in favor of one specified by a verbosity level.

Related: #8794
Related: #3704

Solution

  • Removes the current verbose mode
  • Defines an OutputMode w/ Normal and Quiet, same behavior
  • Fixes missing debug fields
  • Fixes duplicate missed --json field
  • Removes some minor instances of -v already being in use in favor of the global flag: this is a breaking change

Output:

Display options:
      --color <COLOR>
          The color of the log messages

          Possible values:
          - auto:   Intelligently guess whether to use color output (default)
          - always: Force color output
          - never:  Force disable color output

      --json
          Format log messages as JSON

  -q, --quiet
          Do not print log messages

  -v, --verbosity...
          Verbosity level of the log messages.
          
          Pass multiple times to increase the verbosity (e.g. -v, -vv, -vvv).
          
          Depending on the context the verbosity levels have different meanings.

@zerosnacks zerosnacks changed the title feat(common::shell): add global verbosity level to common::shell (-vvv) feat(common::shell): add global verbosity level (-vvv) flag Nov 6, 2024
@zerosnacks zerosnacks changed the title feat(common::shell): add global verbosity level (-vvv) flag feat(common::shell): add global verbosity level (-vvv) flag replacing --verbose Nov 6, 2024
Comment on lines +217 to +218
#[clap(flatten)]
pub shell: ShellOpts,
Copy link
Member Author

Choose a reason for hiding this comment

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

Renaming ShellOpts to GlobalOpts + consistent enforcement will be handled in #8408

It will be possible to access the global shell options either directly by e.g. shell::is_quiet, etc.. as well as by args.global.shell().is_quiet()

#[arg(long, short)]
#[arg(long)]
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: breaking change

#[arg(long, short)]
#[arg(long)]
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: breaking change

Comment on lines -51 to -53
/// Prints the full address of the contract.
#[arg(long, short)]
verbose: bool,
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: breaking change, equivalent

Comment on lines -186 to -188
/// Verbose mode, print the address and private key.
#[arg(short = 'v', long)]
verbose: bool,
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: breaking change, equivalent

Comment on lines -104 to -115
/// Verbosity of the EVM.
///
/// Pass multiple times to increase the verbosity (e.g. -v, -vv, -vvv).
///
/// Verbosity levels:
/// - 2: Print logs for all tests
/// - 3: Print execution traces for failing tests
/// - 4: Print execution traces for all tests, and setup traces for failing tests
/// - 5: Print execution and setup traces for all tests
#[arg(long, short, verbatim_doc_comment, action = ArgAction::Count)]
#[serde(skip)]
pub verbosity: u8,
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: global verbosity setting is exact equivalent except the description, not sure what a practical way is to modify the verbosity flag description to be more context dependent

@zerosnacks zerosnacks marked this pull request as ready for review November 7, 2024 11:34
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 merged commit 22cf683 into master Nov 13, 2024
21 checks passed
@zerosnacks zerosnacks deleted the zerosnacks/add-verbosity-level-common-shell branch November 13, 2024 10:59
rplusq pushed a commit to rplusq/foundry that referenced this pull request Nov 29, 2024
…cing `--verbose` (foundry-rs#9273)

* remove --verbose, prefer output mode, introduce verbosity level (-vvv)

* remove leftover

* fix arg

* add ability to set verbosity level

* fix tests

* remove evm args specific verbosity arg in favor of global arg due to Clap limitation

* revert test modifications from foundry-rs#9244 for TestArgs, simply pass + flatten ShellOpts in args

* in lieu of a context specific help document the verbosity levels of the EVM as an example

* format comment, update tests

* fix clippy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

2 participants