Skip to content

Commit

Permalink
cli help: add code blocks to make help render as markdown properly
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyagr committed Jan 30, 2024
1 parent eeb9fcb commit 9f71b31
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions cli/src/commands/next.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,28 @@ use crate::ui::Ui;
/// The command moves you to the next child in a linear fashion.
///
///
/// ```
/// D D @
/// | |/
/// C @ => C
/// |/ |
/// B B
/// ```
///
///
/// If `--edit` is passed, it will move you directly to the child
/// revision.
///
///
/// ```
/// D D
/// | |
/// C C
/// | |
/// B => @
/// | |
/// @ A
/// ```
#[derive(clap::Args, Clone, Debug)]
#[command(verbatim_doc_comment)]
pub(crate) struct NextArgs {
Expand Down
7 changes: 4 additions & 3 deletions cli/src/commands/prev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,26 @@ use crate::ui::Ui;
///
/// The command moves you to the parent in a linear fashion.
///
///
/// ```
/// D @ D
/// |/ |
/// A => A @
/// | | /
/// B B
///
/// ```
///
/// If `--edit` is passed, it will move the working copy commit
/// directly to the parent.
///
///
/// ```
/// D @ D
/// |/ |
/// C => @
/// | |
/// B B
/// | |
/// A A
/// ```
// TODO(#2126): Handle multiple parents, e.g merges.
#[derive(clap::Args, Clone, Debug)]
#[command(verbatim_doc_comment)]
Expand Down
8 changes: 8 additions & 0 deletions cli/src/commands/rebase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ use crate::ui::Ui;
/// your history like this (letters followed by an apostrophe are post-rebase
/// versions):
///
/// ```
/// O N'
/// | |
/// | N M'
Expand All @@ -57,6 +58,7 @@ use crate::ui::Ui;
/// | K | K
/// |/ |/
/// J J
/// ```
///
/// With `-b`, the command rebases the whole "branch" containing the specified
/// revision. A "branch" is the set of commits that includes:
Expand All @@ -71,6 +73,7 @@ use crate::ui::Ui;
/// -d O` would transform your history like this (because `L` and `M` are on the
/// same "branch", relative to the destination):
///
/// ```
/// O N'
/// | |
/// | N M'
Expand All @@ -82,32 +85,37 @@ use crate::ui::Ui;
/// | K O
/// |/ |
/// J J
/// ```
///
/// With `-r`, the command rebases only the specified revision onto the
/// destination. Any "hole" left behind will be filled by rebasing descendants
/// onto the specified revision's parent(s). For example, `jj rebase -r K -d M`
/// would transform your history like this:
///
/// ```
/// M K'
/// | |
/// | L M
/// | | => |
/// | K | L'
/// |/ |/
/// J J
/// ```
///
/// Note that you can create a merge commit by repeating the `-d` argument.
/// For example, if you realize that commit L actually depends on commit M in
/// order to work (in addition to its current parent K), you can run `jj rebase
/// -s L -d K -d M`:
///
/// ```
/// M L'
/// | |\
/// | L M |
/// | | => | |
/// | K | K
/// |/ |/
/// J J
/// ```
#[derive(clap::Args, Clone, Debug)]
#[command(verbatim_doc_comment)]
#[command(group(ArgGroup::new("to_rebase").args(&["branch", "source", "revision"])))]
Expand Down

0 comments on commit 9f71b31

Please sign in to comment.