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).",
/// Send a signal to the process when it's still running
///
/// Specify a signal to send to the process when it's still running. This implies
/// '--on-busy-update=signal'; otherwise the signal used when that mode is 'restart' is
/// controlled by '--stop-signal'.
///
/// See the long documentation for '--stop-signal' for syntax.
#[arg(
short,
long,
conflicts_with_all=["restart","watch_when_idle"],
value_name="SIGNAL"
)]
pubsignal: Option<SubSignal>,
/// Hidden legacy shorthand for '--signal=kill'.
#[arg(short, long, hide = true)]
pubkill: bool,
/// Signal to send to stop the command
///
/// This is used by 'restart' and 'signal' modes of '--on-busy-update' (unless '--signal' is
/// provided). The restart behaviour is to send the signal, wait for the command to exit, and if
/// it hasn't exited after some time (see '--timeout-stop'), forcefully terminate it.
///
/// The default on unix is "SIGTERM".
///
/// Input is parsed as a full signal name (like "SIGTERM"), a short signal name (like "TERM"),
/// or a signal number (like "15"). All input is case-insensitive.
///
/// On Windows this option is technically supported but only supports the "KILL" event, as
/// Watchexec cannot yet deliver other events. Windows doesn't have signals as such; instead it
/// has termination (here called "KILL" or "STOP") and "CTRL+C", "CTRL+BREAK", and "CTRL+CLOSE"
/// events. For portability the unix signals "SIGKILL", "SIGINT", "SIGTERM", and "SIGHUP" are
/// respectively mapped to these.
#[arg(long, value_name = "SIGNAL")]
pubstop_signal: Option<SubSignal>,
/// Time to wait for the command to exit gracefully
///
/// This is used by the 'restart' mode of '--on-busy-update'. After the graceful stop signal
/// is sent, Watchexec will wait for the command to exit. If it hasn't exited after this time,
/// it is forcefully terminated.
///
/// Takes a unit-less value in seconds, or a time span value such as "5min 20s".
///
/// The default is 60 seconds. Set to 0 to immediately force-kill the command.
#[arg(
long,
default_value="60",
hide_default_value=true,
value_name="TIMEOUT"
)]
pubstop_timeout: TimeSpan,
/// Time to wait for new events before taking action
///
/// When an event is received, Watchexec will wait for up to this amount of time before handling
/// it (such as running the command). This is essential as what you might perceive as a single
/// change may actually emit many events, and without this behaviour, Watchexec would run much
/// too often. Additionally, it's not infrequent that file writes are not atomic, and each write
/// may emit an event, so this is a good way to avoid running a command while a file is
/// partially written.
///
/// An alternative use is to set a high value (like "30min" or longer), to save power or
/// bandwidth on intensive tasks, like an ad-hoc backup script. In those use cases, note that
/// every accumulated event will build up in memory.
///
/// Takes a unit-less value in milliseconds, or a time span value such as "5sec 20ms".
///
/// The default is 50 milliseconds. Setting to 0 is highly discouraged.
#[arg(
long,
default_value="50",
hide_default_value=true,
value_name="TIMEOUT"
)]
pubdebounce: TimeSpan<1_000_000>,
/// Exit when stdin closes
///
/// This watches the stdin file descriptor for EOF, and exits Watchexec gracefully when it is
/// closed. This is used by some process managers to avoid leaving zombie processes around.
#[arg(long)]
pubstdin_quit: bool,
/// Don't load gitignores
///
/// Among other VCS exclude files, like for Mercurial, Subversion, Bazaar, DARCS, Fossil. Note
/// that Watchexec will detect which of these is in use, if any, and only load the relevant
/// files. Both global (like '~/.gitignore') and local (like '.gitignore') files are considered.
///
/// This option is useful if you want to watch files that are ignored by Git.
#[arg(
long,
help_heading=OPTSET_FILTERING,
)]
pubno_vcs_ignore: bool,
/// Don't load project-local ignores
///
/// This disables loading of project-local ignore files, like '.gitignore' or '.ignore' in the
/// watched project. This is contrasted with '--no-vcs-ignore', which disables loading of Git
/// and other VCS ignore files, and with '--no-global-ignore', which disables loading of global
/// or user ignore files, like '~/.gitignore' or '~/.config/watchexec/ignore'.
///
/// Supported project ignore files:
///
/// - Git: .gitignore at project root and child directories, .git/info/exclude, and the file pointed to by `core.excludesFile` in .git/config.
/// - Mercurial: .hgignore at project root and child directories.
/// - Bazaar: .bzrignore at project root.
/// - Darcs: _darcs/prefs/boring
/// - Fossil: .fossil-settings/ignore-glob
/// - Ripgrep/Watchexec/generic: .ignore at project root and child directories.
///
/// VCS ignore files (Git, Mercurial, Bazaar, Darcs, Fossil) are only used if the corresponding
/// VCS is discovered to be in use for the project/origin. For example, a .bzrignore in a Git
/// repository will be discarded.
///
/// Note that this was previously called '--no-ignore', but that's now deprecated and its use is
/// discouraged, as it may be repurposed in the future.
#[arg(
long,
help_heading=OPTSET_FILTERING,
verbatim_doc_comment,
alias="no-ignore",// deprecated
)]
pubno_project_ignore: bool,
/// Don't load global ignores
///
/// This disables loading of global or user ignore files, like '~/.gitignore',
/// '~/.config/watchexec/ignore', or '%APPDATA%\Bazzar\2.0\ignore'. Contrast with
/// '--no-vcs-ignore' and '--no-project-ignore'.
///
/// Supported global ignore files
///
/// - Git (if core.excludesFile is set): the file at that path
/// - Git (otherwise): the first found of $XDG_CONFIG_HOME/git/ignore, %APPDATA%/.gitignore, %USERPROFILE%/.gitignore, $HOME/.config/git/ignore, $HOME/.gitignore.
/// - Bazaar: the first found of %APPDATA%/Bazzar/2.0/ignore, $HOME/.bazaar/ignore.
/// - Watchexec: the first found of $XDG_CONFIG_HOME/watchexec/ignore, %APPDATA%/watchexec/ignore, %USERPROFILE%/.watchexec/ignore, $HOME/.watchexec/ignore.
///
/// Like for project files, Git and Bazaar global files will only be used for the corresponding
/// VCS as used in the project.
#[arg(
long,
help_heading=OPTSET_FILTERING,
verbatim_doc_comment,
)]
pubno_global_ignore: bool,
/// Don't use internal default ignores
///
/// Watchexec has a set of default ignore patterns, such as editor swap files, `*.pyc`, `*.pyo`,
/// `.DS_Store`, `.bzr`, `_darcs`, `.fossil-settings`, `.git`, `.hg`, `.pijul`, `.svn`, and
/// Watchexec log files.
#[arg(
long,
help_heading=OPTSET_FILTERING,
)]
pubno_default_ignore: bool,
/// Wait until first change before running command
///
/// By default, Watchexec will run the command once immediately. With this option, it will
/// instead wait until an event is detected before running the command as normal.
#[arg(long, short)]
pubpostpone: bool,
/// Sleep before running the command
///
/// This option will cause Watchexec to sleep for the specified amount of time before running
/// the command, after an event is detected. This is like using "sleep 5 && command" in a shell,
/// but portable and slightly more efficient.
///
/// Takes a unit-less value in seconds, or a time span value such as "2min 5s".
#[arg(long, value_name = "DURATION")]
pubdelay_run: Option<TimeSpan>,
/// Poll for filesystem changes
///
/// By default, and where available, Watchexec uses the operating system's native file system
/// watching capabilities. This option disables that and instead uses a polling mechanism, which
/// is less efficient but can work around issues with some file systems (like network shares) or
/// edge cases.
///
/// Optionally takes a unit-less value in milliseconds, or a time span value such as "2s 500ms",
/// to use as the polling interval. If not specified, the default is 30 seconds.
///
/// Aliased as '--force-poll'.
#[arg(
long,
alias="force-poll",
num_args=0..=1,
default_missing_value="30s",
value_name="INTERVAL",
)]
pubpoll: Option<TimeSpan<1_000_000>>,
/// Use a different shell
///
/// By default, Watchexec will use 'sh' on unix and 'cmd' (CMD.EXE) on Windows. With this, you
/// can override that and use a different shell, for example one with more features or one which
/// has your custom aliases and functions.
///
/// If the value has spaces, it is parsed as a command line, and the first word used as the
/// shell program, with the rest as arguments to the shell.
///
/// The command is run with the '-c' flag (except for 'cmd' and 'powershell' on Windows, where
/// the '/C' option is used).
///
/// Note that the default shell will change at the next major release: the value of '$SHELL'
/// will be respected, falling back to 'sh' on unix and to PowerShell on Windows.
///
/// The special value 'none' can be used to disable shell use entirely. In that case, the
/// command provided to Watchexec will be parsed, with the first word being the executable and
/// the rest being the arguments, and executed directly. Note that this parsing is rudimentary,
/// and may not work as expected in all cases.
///
/// Using 'none' is a little more efficient and can enable a stricter interpretation of the
/// input, but it also means that you can't use shell features like globbing, redirection, or