Skip to content

Commit

Permalink
diffedit: separate extra help information in its own paragraph
Browse files Browse the repository at this point in the history
  • Loading branch information
samueltardieu committed Sep 18, 2024
1 parent a2e67bd commit 726cbbd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
13 changes: 9 additions & 4 deletions cli/src/commands/diffedit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,19 @@ use crate::ui::Ui;
/// changes into or out of the parent revision.
#[derive(clap::Args, Clone, Debug)]
pub(crate) struct DiffeditArgs {
/// The revision to touch up. Defaults to @ if neither --to nor --from are
/// specified.
/// The revision to touch up
///
/// Defaults to @ if neither --to nor --from are specified.
#[arg(long, short)]
revision: Option<RevisionArg>,
/// Show changes from this revision. Defaults to @ if --to is specified.
/// Show changes from this revision
///
/// Defaults to @ if --to is specified.
#[arg(long, conflicts_with = "revision")]
from: Option<RevisionArg>,
/// Edit changes in this revision. Defaults to @ if --from is specified.
/// Edit changes in this revision
///
/// Defaults to @ if --from is specified.
#[arg(long, conflicts_with = "revision")]
to: Option<RevisionArg>,
/// Specify diff editor to be used
Expand Down
12 changes: 9 additions & 3 deletions cli/tests/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -657,9 +657,15 @@ See `jj restore` if you want to move entire files from one revision to another.
###### **Options:**
* `-r`, `--revision <REVISION>` — The revision to touch up. Defaults to @ if neither --to nor --from are specified
* `--from <FROM>` — Show changes from this revision. Defaults to @ if --to is specified
* `--to <TO>` — Edit changes in this revision. Defaults to @ if --from is specified
* `-r`, `--revision <REVISION>` — The revision to touch up
Defaults to @ if neither --to nor --from are specified.
* `--from <FROM>` — Show changes from this revision
Defaults to @ if --to is specified.
* `--to <TO>` — Edit changes in this revision
Defaults to @ if --from is specified.
* `--tool <NAME>` — Specify diff editor to be used
Expand Down
11 changes: 5 additions & 6 deletions cli/tests/test_global_opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,16 +592,15 @@ fn test_help() {
let test_env = TestEnvironment::default();

let stdout = test_env.jj_cmd_success(test_env.env_root(), &["diffedit", "-h"]);
insta::assert_snapshot!(stdout, @r###"
insta::assert_snapshot!(stdout, @r#"
Touch up the content changes in a revision with a diff editor
Usage: jj diffedit [OPTIONS]
Options:
-r, --revision <REVISION> The revision to touch up. Defaults to @ if neither --to nor --from are
specified
--from <FROM> Show changes from this revision. Defaults to @ if --to is specified
--to <TO> Edit changes in this revision. Defaults to @ if --from is specified
-r, --revision <REVISION> The revision to touch up
--from <FROM> Show changes from this revision
--to <TO> Edit changes in this revision
--tool <NAME> Specify diff editor to be used
-h, --help Print help (see more with '--help')
Expand All @@ -615,7 +614,7 @@ fn test_help() {
--quiet Silence non-primary command output
--no-pager Disable the pager
--config-toml <TOML> Additional configuration options (can be repeated)
"###);
"#);
}

#[test]
Expand Down

0 comments on commit 726cbbd

Please sign in to comment.