Add --project-origin override
This commit is contained in:
parent
4a6d4350c5
commit
84aac2243c
|
@ -153,7 +153,12 @@ pub fn get_args(tagged_filterer: bool) -> Result<ArgMatches<'static>> {
|
|||
.help_heading(Some(OPTSET_OUTPUT))
|
||||
.help("Send a desktop notification when the command ends")
|
||||
.short("N")
|
||||
.long("notify"));
|
||||
.long("notify"))
|
||||
.arg(Arg::with_name("project-origin")
|
||||
.help_heading(Some(OPTSET_FILTERING))
|
||||
.help("Override the project origin: the directory from which ignore files are detected")
|
||||
.value_name("path")
|
||||
.long("project-origin"));
|
||||
|
||||
let app = if tagged_filterer {
|
||||
app.arg(
|
||||
|
|
|
@ -20,6 +20,10 @@ pub async fn dirs(args: &ArgMatches<'static>) -> Result<(PathBuf, PathBuf)> {
|
|||
.into_diagnostic()?;
|
||||
debug!(?curdir, "current directory");
|
||||
|
||||
let project_origin = if let Some(origin) = args.value_of("project-origin") {
|
||||
debug!(?origin, "project origin override");
|
||||
canonicalize(origin).into_diagnostic()?
|
||||
} else {
|
||||
let homedir = dirs::home_dir()
|
||||
.map(canonicalize)
|
||||
.transpose()
|
||||
|
@ -65,11 +69,12 @@ pub async fn dirs(args: &ArgMatches<'static>) -> Result<(PathBuf, PathBuf)> {
|
|||
debug!(?origins, "resolved all project origins");
|
||||
|
||||
// This canonicalize is probably redundant
|
||||
let project_origin = canonicalize(
|
||||
canonicalize(
|
||||
common_prefix(&origins)
|
||||
.ok_or_else(|| miette!("no common prefix, but this should never fail"))?,
|
||||
)
|
||||
.into_diagnostic()?;
|
||||
.into_diagnostic()?
|
||||
};
|
||||
debug!(?project_origin, "resolved common/project origin");
|
||||
|
||||
let workdir = curdir;
|
||||
|
|
|
@ -39,6 +39,8 @@ OPTIONS:
|
|||
[possible values: do-nothing, queue, restart, signal]
|
||||
-w, --watch <path>... Watch a specific file or directory
|
||||
--force-poll <interval> Force polling mode (interval in milliseconds)
|
||||
--project-origin <path> Override the project origin: the directory from which ignore files are
|
||||
detected
|
||||
--shell <shell> Use a different shell, or `none`. Defaults to `sh` (until 2.0, where that
|
||||
will change to `$SHELL`). E.g. --shell=bash
|
||||
-s, --signal <signal> Specify the signal to send when using --on-busy-update=signal
|
||||
|
|
|
@ -38,6 +38,8 @@ OPTIONS:
|
|||
[possible values: do-nothing, queue, restart, signal]
|
||||
-w, --watch <path>... Watch a specific file or directory
|
||||
--force-poll <interval> Force polling mode (interval in milliseconds)
|
||||
--project-origin <path> Override the project origin: the directory from which ignore files are
|
||||
detected
|
||||
--shell <shell> Use a different shell, or `none`. Try --shell=powershell, which will become
|
||||
the default in 2.0.
|
||||
-s, --signal <signal> Specify the signal to send when using --on-busy-update=signal
|
||||
|
|
Loading…
Reference in New Issue