Skip to content

Commit 3f13a98

Browse files
authored
chore: improve help text for forge snapshot (#1304)
1 parent a5e58ad commit 3f13a98

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

cli/src/cmd/forge/snapshot.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,39 @@ pub static RE_BASIC_SNAPSHOT_ENTRY: Lazy<Regex> = Lazy::new(|| {
3333
#[derive(Debug, Clone, Parser)]
3434
pub struct SnapshotArgs {
3535
/// All test arguments are supported
36-
#[clap(flatten)]
36+
#[clap(flatten, next_help_heading = "TEST OPTIONS")]
3737
pub(crate) test: test::TestArgs,
3838

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

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

54+
/// Compare against a pre-existing snapshot, exiting with code 1 if they do not match.
55+
///
56+
/// Outputs a diff if the snapshots do not match.
57+
///
58+
/// By default the comparison is done with .gas-snapshot.
5259
#[clap(
53-
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",
5460
conflicts_with = "diff",
5561
long,
5662
value_hint = ValueHint::FilePath,
5763
value_name = "SNAPSHOT_FILE",
5864
)]
5965
check: Option<Option<PathBuf>>,
6066

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

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

0 commit comments

Comments
 (0)