dynamic completion: add revision completion to hidden -r arguments

Before this commmit, `jj desc <tab>` resulted in revision completions, but the equivalent `jj desc -r <tab>` didn't.
This commit is contained in:
Ilya Grigoriev 2025-01-19 22:14:42 -08:00
parent a6f20cf42f
commit cf69a36a62
3 changed files with 18 additions and 3 deletions

View file

@ -47,7 +47,12 @@ pub(crate) struct AbandonArgs {
add = ArgValueCandidates::new(complete::mutable_revisions)
)]
revisions_pos: Vec<RevisionArg>,
#[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<RevisionArg>,
/// Do not print every abandoned commit on a separate line
#[arg(long, short)]

View file

@ -49,7 +49,12 @@ pub(crate) struct DescribeArgs {
add = ArgValueCandidates::new(complete::mutable_revisions)
)]
revisions_pos: Vec<RevisionArg>,
#[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<RevisionArg>,
/// The change description to use (don't open editor)
///

View file

@ -57,7 +57,12 @@ pub(crate) struct DuplicateArgs {
add = ArgValueCandidates::new(complete::all_revisions)
)]
revisions_pos: Vec<RevisionArg>,
#[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<RevisionArg>,
/// The revision(s) to duplicate onto (can be repeated to create a merge
/// commit)