mirror of
https://github.com/martinvonz/jj.git
synced 2025-05-19 14:14:28 +00:00
cli: add value_hint to support basic path completion
Otherwise 'jj diff [TAB]' doesn't provide completion on my zsh.
This commit is contained in:
parent
3c22ce11a4
commit
f3d39c7820
@ -1073,7 +1073,13 @@ struct GlobalArgs {
|
|||||||
///
|
///
|
||||||
/// By default, Jujutsu searches for the closest .jj/ directory in an
|
/// By default, Jujutsu searches for the closest .jj/ directory in an
|
||||||
/// ancestor of the current working directory.
|
/// ancestor of the current working directory.
|
||||||
#[clap(long, short = 'R', global = true, help_heading = "GLOBAL OPTIONS")]
|
#[clap(
|
||||||
|
long,
|
||||||
|
short = 'R',
|
||||||
|
global = true,
|
||||||
|
help_heading = "GLOBAL OPTIONS",
|
||||||
|
value_hint = clap::ValueHint::DirPath,
|
||||||
|
)]
|
||||||
repository: Option<String>,
|
repository: Option<String>,
|
||||||
/// Don't commit the working copy
|
/// Don't commit the working copy
|
||||||
///
|
///
|
||||||
@ -1193,13 +1199,13 @@ struct VersionArgs {}
|
|||||||
#[clap(group(ArgGroup::new("backend").args(&["git", "git-repo"])))]
|
#[clap(group(ArgGroup::new("backend").args(&["git", "git-repo"])))]
|
||||||
struct InitArgs {
|
struct InitArgs {
|
||||||
/// The destination directory
|
/// The destination directory
|
||||||
#[clap(default_value = ".")]
|
#[clap(default_value = ".", value_hint = clap::ValueHint::DirPath)]
|
||||||
destination: String,
|
destination: String,
|
||||||
/// Use the Git backend, creating a jj repo backed by a Git repo
|
/// Use the Git backend, creating a jj repo backed by a Git repo
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
git: bool,
|
git: bool,
|
||||||
/// Path to a git repo the jj repo will be backed by
|
/// Path to a git repo the jj repo will be backed by
|
||||||
#[clap(long)]
|
#[clap(long, value_hint = clap::ValueHint::DirPath)]
|
||||||
git_repo: Option<String>,
|
git_repo: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1221,7 +1227,7 @@ struct CheckoutArgs {
|
|||||||
#[derive(clap::Args, Clone, Debug)]
|
#[derive(clap::Args, Clone, Debug)]
|
||||||
struct UntrackArgs {
|
struct UntrackArgs {
|
||||||
/// Paths to untrack
|
/// Paths to untrack
|
||||||
#[clap(required = true)]
|
#[clap(required = true, value_hint = clap::ValueHint::AnyPath)]
|
||||||
paths: Vec<String>,
|
paths: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1232,6 +1238,7 @@ struct FilesArgs {
|
|||||||
#[clap(long, short, default_value = "@")]
|
#[clap(long, short, default_value = "@")]
|
||||||
revision: String,
|
revision: String,
|
||||||
/// Only list files matching these prefixes (instead of all files)
|
/// Only list files matching these prefixes (instead of all files)
|
||||||
|
#[clap(value_hint = clap::ValueHint::AnyPath)]
|
||||||
paths: Vec<String>,
|
paths: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1242,6 +1249,7 @@ struct PrintArgs {
|
|||||||
#[clap(long, short, default_value = "@")]
|
#[clap(long, short, default_value = "@")]
|
||||||
revision: String,
|
revision: String,
|
||||||
/// The file to print
|
/// The file to print
|
||||||
|
#[clap(value_hint = clap::ValueHint::FilePath)]
|
||||||
path: String,
|
path: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1282,6 +1290,7 @@ struct DiffArgs {
|
|||||||
#[clap(long, conflicts_with = "revision")]
|
#[clap(long, conflicts_with = "revision")]
|
||||||
to: Option<String>,
|
to: Option<String>,
|
||||||
/// Restrict the diff to these paths
|
/// Restrict the diff to these paths
|
||||||
|
#[clap(value_hint = clap::ValueHint::AnyPath)]
|
||||||
paths: Vec<String>,
|
paths: Vec<String>,
|
||||||
#[clap(flatten)]
|
#[clap(flatten)]
|
||||||
format: DiffFormatArgs,
|
format: DiffFormatArgs,
|
||||||
@ -1320,6 +1329,7 @@ struct LogArgs {
|
|||||||
)]
|
)]
|
||||||
revisions: String,
|
revisions: String,
|
||||||
/// Show commits modifying the given paths
|
/// Show commits modifying the given paths
|
||||||
|
#[clap(value_hint = clap::ValueHint::AnyPath)]
|
||||||
paths: Vec<String>,
|
paths: Vec<String>,
|
||||||
/// Show revisions in the opposite order (older revisions first)
|
/// Show revisions in the opposite order (older revisions first)
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
@ -1378,6 +1388,7 @@ struct InterdiffArgs {
|
|||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
to: Option<String>,
|
to: Option<String>,
|
||||||
/// Restrict the diff to these paths
|
/// Restrict the diff to these paths
|
||||||
|
#[clap(value_hint = clap::ValueHint::AnyPath)]
|
||||||
paths: Vec<String>,
|
paths: Vec<String>,
|
||||||
#[clap(flatten)]
|
#[clap(flatten)]
|
||||||
format: DiffFormatArgs,
|
format: DiffFormatArgs,
|
||||||
@ -1506,7 +1517,7 @@ struct MoveArgs {
|
|||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
interactive: bool,
|
interactive: bool,
|
||||||
/// Move only changes to these paths (instead of all paths)
|
/// Move only changes to these paths (instead of all paths)
|
||||||
#[clap(conflicts_with = "interactive")]
|
#[clap(conflicts_with = "interactive", value_hint = clap::ValueHint::AnyPath)]
|
||||||
paths: Vec<String>,
|
paths: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1529,7 +1540,7 @@ struct SquashArgs {
|
|||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
interactive: bool,
|
interactive: bool,
|
||||||
/// Move only changes to these paths (instead of all paths)
|
/// Move only changes to these paths (instead of all paths)
|
||||||
#[clap(conflicts_with = "interactive")]
|
#[clap(conflicts_with = "interactive", value_hint = clap::ValueHint::AnyPath)]
|
||||||
paths: Vec<String>,
|
paths: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1576,7 +1587,7 @@ struct RestoreArgs {
|
|||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
interactive: bool,
|
interactive: bool,
|
||||||
/// Restore only these paths (instead of all paths)
|
/// Restore only these paths (instead of all paths)
|
||||||
#[clap(conflicts_with = "interactive")]
|
#[clap(conflicts_with = "interactive", value_hint = clap::ValueHint::AnyPath)]
|
||||||
paths: Vec<String>,
|
paths: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1608,6 +1619,7 @@ struct SplitArgs {
|
|||||||
#[clap(long, short, default_value = "@")]
|
#[clap(long, short, default_value = "@")]
|
||||||
revision: String,
|
revision: String,
|
||||||
/// Put these paths in the first commit and don't run the diff editor
|
/// Put these paths in the first commit and don't run the diff editor
|
||||||
|
#[clap(value_hint = clap::ValueHint::AnyPath)]
|
||||||
paths: Vec<String>,
|
paths: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1835,10 +1847,10 @@ struct WorkspaceListArgs {}
|
|||||||
#[derive(clap::Args, Clone, Debug)]
|
#[derive(clap::Args, Clone, Debug)]
|
||||||
struct SparseArgs {
|
struct SparseArgs {
|
||||||
/// Patterns to add to the working copy
|
/// Patterns to add to the working copy
|
||||||
#[clap(long)]
|
#[clap(long, value_hint = clap::ValueHint::AnyPath)]
|
||||||
add: Vec<String>,
|
add: Vec<String>,
|
||||||
/// Patterns to remove from the working copy
|
/// Patterns to remove from the working copy
|
||||||
#[clap(long, conflicts_with = "clear")]
|
#[clap(long, conflicts_with = "clear", value_hint = clap::ValueHint::AnyPath)]
|
||||||
remove: Vec<String>,
|
remove: Vec<String>,
|
||||||
/// Include no files in the working copy (combine with --add)
|
/// Include no files in the working copy (combine with --add)
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
@ -1910,8 +1922,10 @@ struct GitFetchArgs {
|
|||||||
#[derive(clap::Args, Clone, Debug)]
|
#[derive(clap::Args, Clone, Debug)]
|
||||||
struct GitCloneArgs {
|
struct GitCloneArgs {
|
||||||
/// URL or path of the Git repo to clone
|
/// URL or path of the Git repo to clone
|
||||||
|
#[clap(value_hint = clap::ValueHint::DirPath)]
|
||||||
source: String,
|
source: String,
|
||||||
/// The directory to write the Jujutsu repo to
|
/// The directory to write the Jujutsu repo to
|
||||||
|
#[clap(value_hint = clap::ValueHint::DirPath)]
|
||||||
destination: Option<String>,
|
destination: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user