From d8fccae1c806efdf3257313b1e7a916ade5a5e4e Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Thu, 25 Jan 2024 18:51:23 -0800 Subject: [PATCH] cli `help`: add code blocks to make help render as markdown properly --- cli/src/commands/next.rs | 4 ++++ cli/src/commands/prev.rs | 7 ++++--- cli/src/commands/rebase.rs | 8 ++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/cli/src/commands/next.rs b/cli/src/commands/next.rs index 1b12887d85..0265ada2c1 100644 --- a/cli/src/commands/next.rs +++ b/cli/src/commands/next.rs @@ -31,17 +31,20 @@ 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 @@ -49,6 +52,7 @@ use crate::ui::Ui; /// B => @ /// | | /// @ A +/// ``` #[derive(clap::Args, Clone, Debug)] #[command(verbatim_doc_comment)] pub(crate) struct NextArgs { diff --git a/cli/src/commands/prev.rs b/cli/src/commands/prev.rs index 7a8527516c..165b597694 100644 --- a/cli/src/commands/prev.rs +++ b/cli/src/commands/prev.rs @@ -25,18 +25,18 @@ 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 => @ @@ -44,6 +44,7 @@ use crate::ui::Ui; /// B B /// | | /// A A +/// ``` // TODO(#2126): Handle multiple parents, e.g merges. #[derive(clap::Args, Clone, Debug)] #[command(verbatim_doc_comment)] diff --git a/cli/src/commands/rebase.rs b/cli/src/commands/rebase.rs index 437ed0c710..f85f7cad2b 100644 --- a/cli/src/commands/rebase.rs +++ b/cli/src/commands/rebase.rs @@ -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' @@ -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: @@ -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' @@ -82,12 +85,14 @@ 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 @@ -95,12 +100,14 @@ use crate::ui::Ui; /// | 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 | @@ -108,6 +115,7 @@ use crate::ui::Ui; /// | K | K /// |/ |/ /// J J +/// ``` #[derive(clap::Args, Clone, Debug)] #[command(verbatim_doc_comment)] #[command(group(ArgGroup::new("to_rebase").args(&["branch", "source", "revision"])))]