Skip to content

Commit

Permalink
chore: improve help text for forge snapshot (#1304)
Browse files Browse the repository at this point in the history
  • Loading branch information
onbjerg authored Apr 14, 2022
1 parent a5e58ad commit 3f13a98
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions cli/src/cmd/forge/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,39 @@ pub static RE_BASIC_SNAPSHOT_ENTRY: Lazy<Regex> = Lazy::new(|| {
#[derive(Debug, Clone, Parser)]
pub struct SnapshotArgs {
/// All test arguments are supported
#[clap(flatten)]
#[clap(flatten, next_help_heading = "TEST OPTIONS")]
pub(crate) test: test::TestArgs,

/// Additional configs for test results
#[clap(flatten)]
config: SnapshotConfig,

/// Output a diff against a pre-existing snapshot.
///
/// By default the comparison is done with .gas-snapshot.
#[clap(
help = "Compare against a snapshot and display changes from the snapshot. Takes an optional snapshot file, [default: .gas-snapshot]",
conflicts_with = "snap",
long,
value_hint = ValueHint::FilePath,
value_name = "SNAPSHOT_FILE",
)]
diff: Option<Option<PathBuf>>,

/// Compare against a pre-existing snapshot, exiting with code 1 if they do not match.
///
/// Outputs a diff if the snapshots do not match.
///
/// By default the comparison is done with .gas-snapshot.
#[clap(
help = "Run snapshot in 'check' mode and compares against an existing snapshot file, [default: .gas-snapshot]. Exits with 0 if snapshots match. Exits with 1 and prints a diff otherwise",
conflicts_with = "diff",
long,
value_hint = ValueHint::FilePath,
value_name = "SNAPSHOT_FILE",
)]
check: Option<Option<PathBuf>>,

#[clap(help = "How to format the output.", long)]
// Hidden because there is only one option
#[clap(help = "How to format the output.", long, hide(true))]
format: Option<Format>,

#[clap(
Expand Down Expand Up @@ -139,9 +146,9 @@ impl FromStr for Format {
/// Additional filters that can be applied on the test results
#[derive(Debug, Clone, Parser, Default)]
struct SnapshotConfig {
#[clap(help = "sort results by ascending gas used.", long)]
#[clap(help = "Sort results by gas used (ascending).", long)]
asc: bool,
#[clap(help = "sort results by descending gas used.", conflicts_with = "asc", long)]
#[clap(help = "Sort results by gas used (descending).", conflicts_with = "asc", long)]
desc: bool,
#[clap(help = "Only include tests that used more gas that the given amount.", long)]
min: Option<u64>,
Expand Down

0 comments on commit 3f13a98

Please sign in to comment.