mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-19 19:08:08 +00:00
completion: add completion for jj bookmark {create,set} --revision
This commit is contained in:
parent
0de36918e4
commit
2504703b0d
2 changed files with 12 additions and 2 deletions
|
@ -13,6 +13,7 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
use clap::builder::NonEmptyStringValueParser;
|
use clap::builder::NonEmptyStringValueParser;
|
||||||
|
use clap_complete::ArgValueCandidates;
|
||||||
use jj_lib::object_id::ObjectId as _;
|
use jj_lib::object_id::ObjectId as _;
|
||||||
use jj_lib::op_store::RefTarget;
|
use jj_lib::op_store::RefTarget;
|
||||||
|
|
||||||
|
@ -21,6 +22,7 @@ use crate::cli_util::CommandHelper;
|
||||||
use crate::cli_util::RevisionArg;
|
use crate::cli_util::RevisionArg;
|
||||||
use crate::command_error::user_error_with_hint;
|
use crate::command_error::user_error_with_hint;
|
||||||
use crate::command_error::CommandError;
|
use crate::command_error::CommandError;
|
||||||
|
use crate::complete;
|
||||||
use crate::ui::Ui;
|
use crate::ui::Ui;
|
||||||
|
|
||||||
/// Create a new bookmark
|
/// Create a new bookmark
|
||||||
|
@ -30,7 +32,11 @@ pub struct BookmarkCreateArgs {
|
||||||
//
|
//
|
||||||
// The `--to` alias exists for making it easier for the user to switch
|
// The `--to` alias exists for making it easier for the user to switch
|
||||||
// between `bookmark create`, `bookmark move`, and `bookmark set`.
|
// between `bookmark create`, `bookmark move`, and `bookmark set`.
|
||||||
#[arg(long, short, visible_alias = "to")]
|
#[arg(
|
||||||
|
long, short,
|
||||||
|
visible_alias = "to",
|
||||||
|
add = ArgValueCandidates::new(complete::all_revisions),
|
||||||
|
)]
|
||||||
revision: Option<RevisionArg>,
|
revision: Option<RevisionArg>,
|
||||||
|
|
||||||
/// The bookmarks to create
|
/// The bookmarks to create
|
||||||
|
|
|
@ -30,7 +30,11 @@ use crate::ui::Ui;
|
||||||
#[derive(clap::Args, Clone, Debug)]
|
#[derive(clap::Args, Clone, Debug)]
|
||||||
pub struct BookmarkSetArgs {
|
pub struct BookmarkSetArgs {
|
||||||
/// The bookmark's target revision
|
/// The bookmark's target revision
|
||||||
#[arg(long, short, visible_alias = "to")]
|
#[arg(
|
||||||
|
long, short,
|
||||||
|
visible_alias = "to",
|
||||||
|
add = ArgValueCandidates::new(complete::all_revisions),
|
||||||
|
)]
|
||||||
revision: Option<RevisionArg>,
|
revision: Option<RevisionArg>,
|
||||||
|
|
||||||
/// Allow moving the bookmark backwards or sideways
|
/// Allow moving the bookmark backwards or sideways
|
||||||
|
|
Loading…
Reference in a new issue