From cf69a36a6233a5931c1c04a63314179983f5b6d6 Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Sun, 19 Jan 2025 22:14:42 -0800 Subject: [PATCH] dynamic completion: add revision completion to hidden -r arguments Before this commmit, `jj desc ` resulted in revision completions, but the equivalent `jj desc -r ` didn't. --- cli/src/commands/abandon.rs | 7 ++++++- cli/src/commands/describe.rs | 7 ++++++- cli/src/commands/duplicate.rs | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/cli/src/commands/abandon.rs b/cli/src/commands/abandon.rs index 5fba0a3b6..6f23d01e4 100644 --- a/cli/src/commands/abandon.rs +++ b/cli/src/commands/abandon.rs @@ -47,7 +47,12 @@ pub(crate) struct AbandonArgs { add = ArgValueCandidates::new(complete::mutable_revisions) )] revisions_pos: Vec, - #[arg(short = 'r', hide = true, value_name = "REVSETS")] + #[arg( + short = 'r', + hide = true, + value_name = "REVSETS", + add = ArgValueCandidates::new(complete::mutable_revisions) + )] revisions_opt: Vec, /// Do not print every abandoned commit on a separate line #[arg(long, short)] diff --git a/cli/src/commands/describe.rs b/cli/src/commands/describe.rs index bcc156b00..1a0fb4f31 100644 --- a/cli/src/commands/describe.rs +++ b/cli/src/commands/describe.rs @@ -49,7 +49,12 @@ pub(crate) struct DescribeArgs { add = ArgValueCandidates::new(complete::mutable_revisions) )] revisions_pos: Vec, - #[arg(short = 'r', hide = true, value_name = "REVSETS")] + #[arg( + short = 'r', + hide = true, + value_name = "REVSETS", + add = ArgValueCandidates::new(complete::mutable_revisions) + )] revisions_opt: Vec, /// The change description to use (don't open editor) /// diff --git a/cli/src/commands/duplicate.rs b/cli/src/commands/duplicate.rs index 0d4b336aa..19c4b7f98 100644 --- a/cli/src/commands/duplicate.rs +++ b/cli/src/commands/duplicate.rs @@ -57,7 +57,12 @@ pub(crate) struct DuplicateArgs { add = ArgValueCandidates::new(complete::all_revisions) )] revisions_pos: Vec, - #[arg(short = 'r', hide = true, value_name = "REVSETS")] + #[arg( + short = 'r', + hide = true, + value_name = "REVSETS", + add = ArgValueCandidates::new(complete::all_revisions) + )] revisions_opt: Vec, /// The revision(s) to duplicate onto (can be repeated to create a merge /// commit)