diff --git a/Cargo.lock b/Cargo.lock index 14bb717..fc34042 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -337,14 +337,28 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "2.34.0" +version = "3.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b" dependencies = [ + "atty", "bitflags", - "term_size", - "textwrap 0.11.0", - "unicode-width", + "clap_lex", + "indexmap", + "lazy_static", + "strsim", + "termcolor", + "terminal_size", + "textwrap 0.15.0", +] + +[[package]] +name = "clap_lex" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213" +dependencies = [ + "os_str_bytes", ] [[package]] @@ -1444,6 +1458,12 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "os_str_bytes" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" + [[package]] name = "owo-colors" version = "3.4.0" @@ -1991,6 +2011,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "strum" version = "0.22.0" @@ -2084,13 +2110,12 @@ dependencies = [ ] [[package]] -name = "term_size" -version = "0.3.2" +name = "termcolor" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ - "libc", - "winapi", + "winapi-util", ] [[package]] @@ -2124,11 +2149,12 @@ checksum = "507e9898683b6c43a9aa55b64259b721b52ba226e0f3779137e50ad114a4c90b" [[package]] name = "textwrap" -version = "0.11.0" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80" dependencies = [ - "term_size", + "smawk", + "unicode-linebreak", "unicode-width", ] @@ -2138,9 +2164,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" dependencies = [ - "smawk", - "unicode-linebreak", - "unicode-width", + "terminal_size", ] [[package]] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 55a3af7..11a4cd3 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -32,9 +32,8 @@ tracing-log = "0.1.3" watchexec = { version = "=2.0.0-pre.14", path = "../lib" } [dependencies.clap] -version = "2.33.3" -default-features = false -features = ["wrap_help"] +version = "3.1.18" +features = ["cargo", "wrap_help"] [dependencies.tokio] version = "1.19.2" diff --git a/cli/src/args.rs b/cli/src/args.rs index ba5c9b7..e9920e3 100644 --- a/cli/src/args.rs +++ b/cli/src/args.rs @@ -6,120 +6,108 @@ use std::{ path::Path, }; -use clap::{crate_version, App, Arg, ArgMatches}; +use clap::{crate_version, Arg, ArgMatches, Command}; use miette::{Context, IntoDiagnostic, Result}; -trait Clap3Compat { - /// Does nothing for clap2, but remove this trait for clap3, and get cool new option groups! - fn help_heading(self, _heading: impl Into>) -> Self - where - Self: Sized, - { - self - } -} +const OPTSET_FILTERING: &str = "Filtering options"; +const OPTSET_COMMAND: &str = "Command options"; +const OPTSET_DEBUGGING: &str = "Debugging options"; +const OPTSET_OUTPUT: &str = "Output options"; +const OPTSET_BEHAVIOUR: &str = "Behaviour options"; -impl Clap3Compat for Arg<'_, '_> {} - -const OPTSET_FILTERING: &str = "Filtering options:"; -const OPTSET_COMMAND: &str = "Command options:"; -const OPTSET_DEBUGGING: &str = "Debugging options:"; -const OPTSET_OUTPUT: &str = "Output options:"; -const OPTSET_BEHAVIOUR: &str = "Behaviour options:"; - -pub fn get_args(tagged_filterer: bool) -> Result> { - let app = App::new("watchexec") +pub fn get_args(tagged_filterer: bool) -> Result { + let app = Command::new("watchexec") .version(crate_version!()) .about("Execute commands when watched files change") .after_help("Use @argfile as first argument to load arguments from the file `argfile` (one argument per line) which will be inserted in place of the @argfile (further arguments on the CLI will override or add onto those in the file).") - .arg(Arg::with_name("command") + .arg(Arg::new("command") .help_heading(Some(OPTSET_COMMAND)) .help("Command to execute") - .multiple(true) + .multiple_occurrences(true) .required(true)) - .arg(Arg::with_name("paths") + .arg(Arg::new("paths") .help_heading(Some(OPTSET_FILTERING)) .help("Watch a specific file or directory") - .short("w") + .short('w') .long("watch") .value_name("path") .number_of_values(1) - .multiple(true) + .multiple_occurrences(true) .takes_value(true)) - .arg(Arg::with_name("clear") + .arg(Arg::new("clear") .help_heading(Some(OPTSET_OUTPUT)) .help("Clear screen before executing command") - .short("c") + .short('c') .long("clear")) - .arg(Arg::with_name("on-busy-update") + .arg(Arg::new("on-busy-update") .help_heading(Some(OPTSET_BEHAVIOUR)) .help("Select the behaviour to use when receiving events while the command is running. Current default is queue, will change to do-nothing in 2.0.") .takes_value(true) .possible_values(&["do-nothing", "queue", "restart", "signal"]) .long("on-busy-update")) - .arg(Arg::with_name("restart") + .arg(Arg::new("restart") .help_heading(Some(OPTSET_BEHAVIOUR)) .help("Restart the process if it's still running. Shorthand for --on-busy-update=restart") - .short("r") + .short('r') .long("restart")) - .arg(Arg::with_name("signal") + .arg(Arg::new("signal") .help_heading(Some(OPTSET_BEHAVIOUR)) .help("Specify the signal to send when using --on-busy-update=signal") - .short("s") + .short('s') .long("signal") .takes_value(true) .value_name("signal")) - .arg(Arg::with_name("kill") + .arg(Arg::new("kill") .help_heading(Some(OPTSET_BEHAVIOUR)) - .hidden(true) - .short("k") + .hide(true) + .short('k') .long("kill")) - .arg(Arg::with_name("debounce") + .arg(Arg::new("debounce") .help_heading(Some(OPTSET_BEHAVIOUR)) .help("Set the timeout between detected change and command execution, defaults to 50ms") .takes_value(true) .value_name("milliseconds") - .short("d") + .short('d') .long("debounce")) - .arg(Arg::with_name("verbose") + .arg(Arg::new("verbose") .help_heading(Some(OPTSET_DEBUGGING)) .help("Print debugging messages (-v, -vv, -vvv, -vvvv; use -vvv for bug reports)") - .multiple(true) - .short("v") + .multiple_occurrences(true) + .short('v') .long("verbose")) - .arg(Arg::with_name("print-events") + .arg(Arg::new("print-events") .help_heading(Some(OPTSET_DEBUGGING)) .help("Print events that trigger actions") .long("print-events") .alias("changes-only")) // --changes-only is deprecated (remove at v2) - .arg(Arg::with_name("no-vcs-ignore") + .arg(Arg::new("no-vcs-ignore") .help_heading(Some(OPTSET_FILTERING)) .help("Skip auto-loading of VCS (Git, etc) ignore files") .long("no-vcs-ignore")) - .arg(Arg::with_name("no-project-ignore") + .arg(Arg::new("no-project-ignore") .help_heading(Some(OPTSET_FILTERING)) .help("Skip auto-loading of project ignore files (.gitignore, .ignore, etc)") .long("no-project-ignore") .alias("no-ignore")) // --no-ignore is deprecated (remove at v2) - .arg(Arg::with_name("no-default-ignore") + .arg(Arg::new("no-default-ignore") .help_heading(Some(OPTSET_FILTERING)) .help("Skip auto-ignoring of commonly ignored globs") .long("no-default-ignore")) - .arg(Arg::with_name("no-global-ignore") + .arg(Arg::new("no-global-ignore") .help_heading(Some(OPTSET_FILTERING)) .help("Skip auto-loading of global or environment-wide ignore files") .long("no-global-ignore")) - .arg(Arg::with_name("postpone") + .arg(Arg::new("postpone") .help_heading(Some(OPTSET_BEHAVIOUR)) .help("Wait until first change to execute command") - .short("p") + .short('p') .long("postpone")) - .arg(Arg::with_name("poll") + .arg(Arg::new("poll") .help_heading(Some(OPTSET_BEHAVIOUR)) .help("Force polling mode (interval in milliseconds)") .long("force-poll") .value_name("interval")) - .arg(Arg::with_name("shell") + .arg(Arg::new("shell") .help_heading(Some(OPTSET_COMMAND)) .help(if cfg!(windows) { "Use a different shell, or `none`. Try --shell=powershell, which will become the default in 2.0." @@ -129,118 +117,118 @@ pub fn get_args(tagged_filterer: bool) -> Result> { .takes_value(true) .long("shell")) // -n short form will not be removed, and instead become a shorthand for --shell=none - .arg(Arg::with_name("no-shell") + .arg(Arg::new("no-shell") .help_heading(Some(OPTSET_COMMAND)) .help("Do not wrap command in a shell. Deprecated: use --shell=none instead.") - .short("n") + .short('n') .long("no-shell")) - .arg(Arg::with_name("no-environment") + .arg(Arg::new("no-environment") .help_heading(Some(OPTSET_COMMAND)) .help("Do not set WATCHEXEC_*_PATH environment variables for the command") .long("no-environment")) - .arg(Arg::with_name("no-process-group") + .arg(Arg::new("no-process-group") .help_heading(Some(OPTSET_COMMAND)) .help("Do not use a process group when running the command") .long("no-process-group")) - .arg(Arg::with_name("once").short("1").hidden(true)) - .arg(Arg::with_name("watch-when-idle") + .arg(Arg::new("once").short('1').hide(true)) + .arg(Arg::new("watch-when-idle") .help_heading(Some(OPTSET_BEHAVIOUR)) .help("Deprecated alias for --on-busy-update=do-nothing, which will become the default in 2.0.") - .short("W") - .hidden(true) + .short('W') + .hide(true) .long("watch-when-idle")) - .arg(Arg::with_name("notif") + .arg(Arg::new("notif") .help_heading(Some(OPTSET_OUTPUT)) .help("Send a desktop notification when the command ends") - .short("N") + .short('N') .long("notify")) - .arg(Arg::with_name("project-origin") + .arg(Arg::new("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")) - .arg(Arg::with_name("command-workdir") + .arg(Arg::new("command-workdir") .help_heading(Some(OPTSET_COMMAND)) .help("Change the working directory of the command") .value_name("path") .long("workdir")) - .arg(Arg::with_name("command-env") + .arg(Arg::new("command-env") .help_heading(Some(OPTSET_COMMAND)) .help("Add an environment variable to the command") .value_name("name=value") .long("env") - .short("E") + .short('E') .number_of_values(1) - .multiple(true)); + .multiple_occurrences(true)); let app = if tagged_filterer { app.arg( - Arg::with_name("filter") + Arg::new("filter") .help_heading(Some(OPTSET_FILTERING)) .help("Add tagged filter (e.g. 'path=foo*', 'type=dir', 'kind=Create(*)')") - .short("f") + .short('f') .long("filter") .number_of_values(1) - .multiple(true) + .multiple_occurrences(true) .takes_value(true) .value_name("tagged filter"), ) .arg( - Arg::with_name("filter-files") + Arg::new("filter-files") .help_heading(Some(OPTSET_FILTERING)) .help("Load tagged filters from a file") - .short("F") + .short('F') .long("filter-file") .number_of_values(1) - .multiple(true) + .multiple_occurrences(true) .takes_value(true) .value_name("path"), ) .arg( - Arg::with_name("no-global-filters") + Arg::new("no-global-filters") .help_heading(Some(OPTSET_FILTERING)) .help("Skip auto-loading of global or environment-wide ignore files") .long("no-default-filters"), ) .arg( - Arg::with_name("no-meta") + Arg::new("no-meta") .help_heading(Some(OPTSET_FILTERING)) .help("Ignore metadata changes (equivalent of `-f 'kind*!Modify(Metadata(*))'`)") .long("no-meta"), ) } else { app.arg( - Arg::with_name("extensions") + Arg::new("extensions") .help_heading(Some(OPTSET_FILTERING)) .help("Comma-separated list of file extensions to watch (e.g. js,css,html)") - .short("e") + .short('e') .long("exts") .takes_value(true), ) .arg( - Arg::with_name("filter") + Arg::new("filter") .help_heading(Some(OPTSET_FILTERING)) .help("Ignore all modifications except those matching the pattern") - .short("f") + .short('f') .long("filter") .number_of_values(1) - .multiple(true) + .multiple_occurrences(true) .takes_value(true) .value_name("pattern"), ) .arg( - Arg::with_name("ignore") + Arg::new("ignore") .help_heading(Some(OPTSET_FILTERING)) .help("Ignore modifications to paths matching the pattern") - .short("i") + .short('i') .long("ignore") .number_of_values(1) - .multiple(true) + .multiple_occurrences(true) .takes_value(true) .value_name("pattern"), ) .arg( - Arg::with_name("no-meta") + Arg::new("no-meta") .help_heading(Some(OPTSET_FILTERING)) .help("Ignore metadata changes") .long("no-meta"), diff --git a/cli/src/config/init.rs b/cli/src/config/init.rs index 15f2173..aa05b36 100644 --- a/cli/src/config/init.rs +++ b/cli/src/config/init.rs @@ -10,7 +10,7 @@ use watchexec::{ ErrorHook, }; -pub fn init(_args: &ArgMatches<'static>) -> Result { +pub fn init(_args: &ArgMatches) -> Result { let mut config = InitConfig::default(); config.on_error(SyncFnHandler::from( |err: ErrorHook| -> std::result::Result<(), Infallible> { diff --git a/cli/src/config/runtime.rs b/cli/src/config/runtime.rs index 6884c70..ee835fb 100644 --- a/cli/src/config/runtime.rs +++ b/cli/src/config/runtime.rs @@ -18,7 +18,7 @@ use watchexec::{ signal::{process::SubSignal, source::MainSignal}, }; -pub fn runtime(args: &ArgMatches<'static>) -> Result { +pub fn runtime(args: &ArgMatches) -> Result { let mut config = RuntimeConfig::default(); config.command( diff --git a/cli/src/filterer/common.rs b/cli/src/filterer/common.rs index 5ccd458..5fd4542 100644 --- a/cli/src/filterer/common.rs +++ b/cli/src/filterer/common.rs @@ -14,7 +14,7 @@ use watchexec::{ project::{self, ProjectType}, }; -pub async fn dirs(args: &ArgMatches<'static>) -> Result<(PathBuf, PathBuf)> { +pub async fn dirs(args: &ArgMatches) -> Result<(PathBuf, PathBuf)> { let curdir = env::current_dir() .and_then(canonicalize) .into_diagnostic()?; @@ -94,7 +94,7 @@ pub async fn vcs_types(origin: &Path) -> Vec { } pub async fn ignores( - args: &ArgMatches<'static>, + args: &ArgMatches, vcs_types: &[ProjectType], origin: &Path, ) -> Vec { diff --git a/cli/src/filterer/globset.rs b/cli/src/filterer/globset.rs index c361bd3..a54bcc9 100644 --- a/cli/src/filterer/globset.rs +++ b/cli/src/filterer/globset.rs @@ -15,7 +15,7 @@ use watchexec::{ filter::{globset::GlobsetFilterer, Filterer}, }; -pub async fn globset(args: &ArgMatches<'static>) -> Result> { +pub async fn globset(args: &ArgMatches) -> Result> { let (project_origin, workdir) = super::common::dirs(args).await?; let vcs_types = super::common::vcs_types(&project_origin).await; let ignore_files = super::common::ignores(args, &vcs_types, &project_origin).await; diff --git a/cli/src/filterer/tagged.rs b/cli/src/filterer/tagged.rs index adbb2a3..749f5d9 100644 --- a/cli/src/filterer/tagged.rs +++ b/cli/src/filterer/tagged.rs @@ -12,7 +12,7 @@ use watchexec::{ ignore::IgnoreFile, }; -pub async fn tagged(args: &ArgMatches<'static>) -> Result> { +pub async fn tagged(args: &ArgMatches) -> Result> { let (project_origin, workdir) = super::common::dirs(args).await?; let vcs_types = super::common::vcs_types(&project_origin).await; let ignores = super::common::ignores(args, &vcs_types, &project_origin).await; diff --git a/cli/tests/snapshots/help__help_unix.snap b/cli/tests/snapshots/help__help_unix.snap index 75b81d8..0069062 100644 --- a/cli/tests/snapshots/help__help_unix.snap +++ b/cli/tests/snapshots/help__help_unix.snap @@ -7,48 +7,67 @@ watchexec 1.19.0 Execute commands when watched files change USAGE: - watchexec [FLAGS] [OPTIONS] ... - -FLAGS: - -c, --clear Clear screen before executing command - -h, --help Prints help information - --no-default-ignore Skip auto-ignoring of commonly ignored globs - --no-environment Do not set WATCHEXEC_*_PATH environment variables for the command - --no-global-ignore Skip auto-loading of global or environment-wide ignore files - --no-meta Ignore metadata changes - --no-process-group Do not use a process group when running the command - --no-project-ignore Skip auto-loading of project ignore files (.gitignore, .ignore, etc) - -n, --no-shell Do not wrap command in a shell. Deprecated: use --shell=none instead. - --no-vcs-ignore Skip auto-loading of VCS (Git, etc) ignore files - -N, --notify Send a desktop notification when the command ends - -p, --postpone Wait until first change to execute command - --print-events Print events that trigger actions - -r, --restart Restart the process if it's still running. Shorthand for --on-busy-update=restart - -V, --version Prints version information - -v, --verbose Print debugging messages (-v, -vv, -vvv, -vvvv; use -vvv for bug reports) + watchexec [OPTIONS] ... OPTIONS: - -E, --env ... Add an environment variable to the command - --workdir Change the working directory of the command - -d, --debounce Set the timeout between detected change and command execution, defaults to - 50ms - -e, --exts Comma-separated list of file extensions to watch (e.g. js,css,html) - -f, --filter ... Ignore all modifications except those matching the pattern - -i, --ignore ... Ignore modifications to paths matching the pattern - --on-busy-update Select the behaviour to use when receiving events while the command is - running. Current default is queue, will change to do-nothing in 2.0. - [possible values: do-nothing, queue, restart, signal] - -w, --watch ... Watch a specific file or directory - --force-poll Force polling mode (interval in milliseconds) - --project-origin Override the project origin: the directory from which ignore files are - detected - --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 Specify the signal to send when using --on-busy-update=signal + -h, --help Print help information + -V, --version Print version information -ARGS: - ... Command to execute +Command options: + -E, --env Add an environment variable to the command + -n, --no-shell Do not wrap command in a shell. Deprecated: use --shell=none instead. + --no-environment Do not set WATCHEXEC_*_PATH environment variables for the command + --no-process-group Do not use a process group when running the command + --shell Use a different shell, or `none`. Defaults to `sh` (until 2.0, where + that will change to `$SHELL`). E.g. --shell=bash + --workdir Change the working directory of the command + ... Command to execute -Use @argfile as first argument to load arguments from the file `argfile` (one argument per line) which will be inserted -in place of the @argfile (further arguments on the CLI will override or add onto those in the file). +Filtering options: + -e, --exts Comma-separated list of file extensions to watch (e.g. + js,css,html) + -f, --filter Ignore all modifications except those matching the pattern + -i, --ignore Ignore modifications to paths matching the pattern + --no-default-ignore Skip auto-ignoring of commonly ignored globs + --no-global-ignore Skip auto-loading of global or environment-wide ignore files + --no-meta Ignore metadata changes + --no-project-ignore Skip auto-loading of project ignore files (.gitignore, .ignore, + etc) + --no-vcs-ignore Skip auto-loading of VCS (Git, etc) ignore files + --project-origin Override the project origin: the directory from which ignore + files are detected + -w, --watch Watch a specific file or directory + +Output options: + -c, --clear Clear screen before executing command + -N, --notify Send a desktop notification when the command ends + +Behaviour options: + -d, --debounce + Set the timeout between detected change and command execution, defaults to 50ms + + --force-poll + Force polling mode (interval in milliseconds) + + --on-busy-update + Select the behaviour to use when receiving events while the command is running. Current + default is queue, will change to do-nothing in 2.0. [possible values: do-nothing, queue, + restart, signal] + + -p, --postpone + Wait until first change to execute command + + -r, --restart + Restart the process if it's still running. Shorthand for --on-busy-update=restart + + -s, --signal + Specify the signal to send when using --on-busy-update=signal + +Debugging options: + --print-events Print events that trigger actions + -v, --verbose Print debugging messages (-v, -vv, -vvv, -vvvv; use -vvv for bug reports) + +Use @argfile as first argument to load arguments from the file `argfile` (one argument per line) +which will be inserted in place of the @argfile (further arguments on the CLI will override or add +onto those in the file). diff --git a/cli/tests/snapshots/help__help_windows.snap b/cli/tests/snapshots/help__help_windows.snap index f0eb3d1..6f5b518 100644 --- a/cli/tests/snapshots/help__help_windows.snap +++ b/cli/tests/snapshots/help__help_windows.snap @@ -1,54 +1,73 @@ --- source: cli/tests/help.rs -expression: String::from_utf8(output.stdout).unwrap() - +assertion_line: 16 +expression: "String::from_utf8(output.stdout).unwrap()" --- watchexec 1.19.0 Execute commands when watched files change USAGE: - watchexec.exe [FLAGS] [OPTIONS] ... - -FLAGS: - -c, --clear Clear screen before executing command - -h, --help Prints help information - --no-default-ignore Skip auto-ignoring of commonly ignored globs - --no-environment Do not set WATCHEXEC_*_PATH environment variables for the command - --no-global-ignore Skip auto-loading of global or environment-wide ignore files - --no-meta Ignore metadata changes - --no-process-group Do not use a process group when running the command - --no-project-ignore Skip auto-loading of project ignore files (.gitignore, .ignore, etc) - -n, --no-shell Do not wrap command in a shell. Deprecated: use --shell=none instead. - --no-vcs-ignore Skip auto-loading of VCS (Git, etc) ignore files - -N, --notify Send a desktop notification when the command ends - -p, --postpone Wait until first change to execute command - --print-events Print events that trigger actions - -r, --restart Restart the process if it's still running. Shorthand for --on-busy-update=restart - -V, --version Prints version information - -v, --verbose Print debugging messages (-v, -vv, -vvv, -vvvv; use -vvv for bug reports) + watchexec.exe [OPTIONS] ... OPTIONS: - -E, --env ... Add an environment variable to the command - --workdir Change the working directory of the command - -d, --debounce Set the timeout between detected change and command execution, defaults to - 50ms - -e, --exts Comma-separated list of file extensions to watch (e.g. js,css,html) - -f, --filter ... Ignore all modifications except those matching the pattern - -i, --ignore ... Ignore modifications to paths matching the pattern - --on-busy-update Select the behaviour to use when receiving events while the command is - running. Current default is queue, will change to do-nothing in 2.0. - [possible values: do-nothing, queue, restart, signal] - -w, --watch ... Watch a specific file or directory - --force-poll Force polling mode (interval in milliseconds) - --project-origin Override the project origin: the directory from which ignore files are - detected - --shell Use a different shell, or `none`. Try --shell=powershell, which will become - the default in 2.0. - -s, --signal Specify the signal to send when using --on-busy-update=signal + -h, --help Print help information + -V, --version Print version information -ARGS: - ... Command to execute +Command options: + -E, --env Add an environment variable to the command + -n, --no-shell Do not wrap command in a shell. Deprecated: use --shell=none instead. + --no-environment Do not set WATCHEXEC_*_PATH environment variables for the command + --no-process-group Do not use a process group when running the command + --shell Use a different shell, or `none`. Try --shell=powershell, which will + become the default in 2.0. + --workdir Change the working directory of the command + ... Command to execute -Use @argfile as first argument to load arguments from the file `argfile` (one argument per line) which will be inserted -in place of the @argfile (further arguments on the CLI will override or add onto those in the file). +Filtering options: + -e, --exts Comma-separated list of file extensions to watch (e.g. + js,css,html) + -f, --filter Ignore all modifications except those matching the pattern + -i, --ignore Ignore modifications to paths matching the pattern + --no-default-ignore Skip auto-ignoring of commonly ignored globs + --no-global-ignore Skip auto-loading of global or environment-wide ignore files + --no-meta Ignore metadata changes + --no-project-ignore Skip auto-loading of project ignore files (.gitignore, .ignore, + etc) + --no-vcs-ignore Skip auto-loading of VCS (Git, etc) ignore files + --project-origin Override the project origin: the directory from which ignore + files are detected + -w, --watch Watch a specific file or directory + +Output options: + -c, --clear Clear screen before executing command + -N, --notify Send a desktop notification when the command ends + +Behaviour options: + -d, --debounce + Set the timeout between detected change and command execution, defaults to 50ms + + --force-poll + Force polling mode (interval in milliseconds) + + --on-busy-update + Select the behaviour to use when receiving events while the command is running. Current + default is queue, will change to do-nothing in 2.0. [possible values: do-nothing, queue, + restart, signal] + + -p, --postpone + Wait until first change to execute command + + -r, --restart + Restart the process if it's still running. Shorthand for --on-busy-update=restart + + -s, --signal + Specify the signal to send when using --on-busy-update=signal + +Debugging options: + --print-events Print events that trigger actions + -v, --verbose Print debugging messages (-v, -vv, -vvv, -vvvv; use -vvv for bug reports) + +Use @argfile as first argument to load arguments from the file `argfile` (one argument per line) +which will be inserted in place of the @argfile (further arguments on the CLI will override or add +onto those in the file).