Merge pull request #53 from akerl/feature/no-default-ignore

Add no-default-ignore option, fixes #45
This commit is contained in:
Matt Green 2017-04-26 09:20:33 -04:00 committed by GitHub
commit a63006bc44
4 changed files with 24 additions and 10 deletions

View File

@ -1,13 +1,13 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "WATCHEXEC" "1" "February 2017" "" ""
.TH "WATCHEXEC" "1" "April 2017" "" ""
.
.SH "NAME"
\fBwatchexec\fR \- execute commands when watched files change
.
.SH "SYNOPSIS"
watchexec [\fB\-\-exts\fR | \fB\-e\fR \fIextensions\fR]\.\.\. [\fB\-\-filter\fR | \fB\-f\fR \fIpattern\fR]\.\.\. [\fB\-\-ignore\fR | \fB\-i\fR \fIpattern\fR]\.\.\. [\fB\-\-watch\fR | \fB\-w\fR \fIpath\fR]\.\.\. [\fB\-\-restart\fR | \fB\-r\fR] [\fB\-\-clear\fR | \fB\-c\fR] [\fB\-\-postpone\fR | \fB\-p\fR] [\fB\-\-force\-poll\fR \fIinterval\fR] [\fB\-\-debug\fR | \fB\-d\fR] [\fB\-\-no\-vcs\-ignore\fR] \fIcommand\fR [\fIargument\fR\.\.\.]
watchexec [\fB\-\-exts\fR | \fB\-e\fR \fIextensions\fR]\.\.\. [\fB\-\-filter\fR | \fB\-f\fR \fIpattern\fR]\.\.\. [\fB\-\-ignore\fR | \fB\-i\fR \fIpattern\fR]\.\.\. [\fB\-\-watch\fR | \fB\-w\fR \fIpath\fR]\.\.\. [\fB\-\-restart\fR | \fB\-r\fR] [\fB\-\-clear\fR | \fB\-c\fR] [\fB\-\-postpone\fR | \fB\-p\fR] [\fB\-\-force\-poll\fR \fIinterval\fR] [\fB\-\-debug\fR | \fB\-d\fR] [\fB\-\-no\-vcs\-ignore\fR] [\fB\-\-no\-default\-ignore\fR] \fIcommand\fR [\fIargument\fR\.\.\.]
.
.SH "DESCRIPTION"
Recursively monitors the current directory for changes, executing the command when a filesystem change is detected\. By default, watchexec uses efficient kernel\-level mechanisms to watch for changes\.
@ -30,12 +30,12 @@ Comma\-separated list of file extensions to filter by\. Leading dots are allowed
Ignores modifications from paths that do not match \fIpattern\fR\. This option can be specified multiple times, where a match on any given pattern causes the path to trigger \fIcommand\fR\.
.
.TP
\fB\-s\fR, \fB\-\-signal <SIGKILL|SIGHUP|...>\fR
\fB\-s\fR, \fB\-\-signal\fR
Sends the specified signal (e\.g\. \fBSIGKILL\fR) to the child process\. Defaults to \fBSIGTERM\fR\.
.
.TP
\fB\-n\fR, \fB\-\-no\-shell\fR
Execute command directly, do not wrap it in \fBsh -c\fR resp\. \fBcmd.exec /C\R\. This is especially useful in combination with \fB--signal\fR, as the signal is then send directly to the specified command\. While \fB--no-shell\fR is a little more performant than the default, it prevents using shell-features like pipes and redirects\.
Execute command directly, do not wrap it in \fBsh \-c\fR resp\. \fBcmd\.exe /C\fR\. This is especially useful in combination with \fB\-\-signal\fR, as the signal is then send directly to the specified command\. While \fB\-\-no\-shell\fR is a little more performant than the default, it prevents using shell\-features like pipes and redirects\.
.
.TP
\fB\-i\fR, \fB\-\-ignore\fR \fIpattern\fR
@ -69,6 +69,10 @@ Poll for changes every \fIinterval\fR ms instead of using system\-specific notif
\fB\-\-no\-vcs\-ignore\fR
Skip loading of version control system (VCS) ignore files\. By default, watchexec loads \.gitignore files in the current directory (or parent directories) and uses them to populate the ignore list\.
.
.TP
\fB\-\-no\-default\-ignore\fR
Skip default ignore statements\. By default, watchexec ignores common temporary files for you, for example \fB*\.swp\fR, \fB*\.pyc\fR, and \fB\.DS_Store\fR
.
.SH "ENVIRONMENT"
Processes started by watchexec have the \fB$WATCHEXEC_UPDATED_PATH\fR environment variable set to the path of the first modification observed\. In addition, the \fB$WATCHEXEC_COMMON_PATH\fR environment variable is set to the common path of all observed modifications\.
.

View File

@ -74,7 +74,7 @@
<h2 id="SYNOPSIS">SYNOPSIS</h2>
<p>watchexec [<code>--exts</code> | <code>-e</code> <var>extensions</var>]... [<code>--filter</code> | <code>-f</code> <var>pattern</var>]... [<code>--ignore</code> | <code>-i</code> <var>pattern</var>]... [<code>--watch</code> | <code>-w</code> <var>path</var>]... [<code>--restart</code> | <code>-r</code>] [<code>--clear</code> | <code>-c</code>] [<code>--postpone</code> | <code>-p</code>] [<code>--force-poll</code> <var>interval</var>] [<code>--debug</code> | <code>-d</code>] [<code>--no-vcs-ignore</code>] <var>command</var> [<var>argument</var>...]</p>
<p>watchexec [<code>--exts</code> | <code>-e</code> <var>extensions</var>]... [<code>--filter</code> | <code>-f</code> <var>pattern</var>]... [<code>--ignore</code> | <code>-i</code> <var>pattern</var>]... [<code>--watch</code> | <code>-w</code> <var>path</var>]... [<code>--restart</code> | <code>-r</code>] [<code>--clear</code> | <code>-c</code>] [<code>--postpone</code> | <code>-p</code>] [<code>--force-poll</code> <var>interval</var>] [<code>--debug</code> | <code>-d</code>] [<code>--no-vcs-ignore</code>] [<code>--no-default-ignore</code>] <var>command</var> [<var>argument</var>...]</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
@ -88,8 +88,8 @@
<dt class="flush"><var>command</var></dt><dd><p>Command to run when watched files are modified, and at startup, unless <code>--postpone</code> is specified. All <var>argument</var>s are passed to <var>command</var>.</p></dd>
<dt><code>-e</code>, <code>--exts</code> <var>extensions</var></dt><dd><p>Comma-separated list of file extensions to filter by. Leading dots are allowed (.rs) are allowed. (This is a shorthand for <code>-f</code>).</p></dd>
<dt><code>-f</code>, <code>--filter</code> <var>pattern</var></dt><dd><p>Ignores modifications from paths that do not match <var>pattern</var>. This option can be specified multiple times, where a match on any given pattern causes the path to trigger <var>command</var>.</p></dd>
<dt><code>-s</code>, <code>--signal</code> <var>SIGNAL</var></dt><dd><p>Sends the specified signal (e.g. <code>SIGKILl</code>) to the child process. Defaults to <code>SIGTERM</code>.</p></dd>
<dt><code>-n</code>, <code>--no-shell</code></dt><dd><p>Execute command directly, do not wrap it in <CODE>sh -c</code> resp. <code>cmd.exec /C</code>. This is especially useful in combination with <code>--signal</code>, as the signal is then send directly to the specified command. While <code>--no-shell</code> is a little more performant than the default, it prevents using shell-features like pipes and redirects.</p></dd>
<dt><code>-s</code>, <code>--signal</code></dt><dd><p>Sends the specified signal (e.g. <code>SIGKILL</code>) to the child process. Defaults to <code>SIGTERM</code>.</p></dd>
<dt><code>-n</code>, <code>--no-shell</code></dt><dd><p>Execute command directly, do not wrap it in <code>sh -c</code> resp. <code>cmd.exe /C</code>. This is especially useful in combination with <code>--signal</code>, as the signal is then send directly to the specified command. While <code>--no-shell</code> is a little more performant than the default, it prevents using shell-features like pipes and redirects.</p></dd>
<dt><code>-i</code>, <code>--ignore</code> <var>pattern</var></dt><dd><p>Ignores modifications from paths that match <var>pattern</var>. This option can be specified multiple times, and a match on any pattern causes the path to be ignored.</p></dd>
<dt><code>-w</code>, <code>--watch</code> <var>path</var></dt><dd><p>Monitor a specific path for changes. By default, the current working directory is watched. This may be specified multiple times, where a change in any watched directory (and subdirectories) causes <var>command</var> to be executed.</p></dd>
<dt><code>-r</code>, <code>--restart</code></dt><dd><p>Terminates the child process group if it is still running when subsequent file modifications are detected. By default, sends <code>SIGTERM</code>; use <code>--kill</code> to send <code>SIGKILL</code>.</p></dd>
@ -98,6 +98,7 @@
<dt><code>-d</code>, <code>--debug</code></dt><dd><p>Prints diagnostic messages to STDERR</p></dd>
<dt><code>--force-poll</code> <var>interval</var></dt><dd><p>Poll for changes every <var>interval</var> ms instead of using system-specific notification mechanisms (such as inotify). This is useful when you are monitoring NFS shares.</p></dd>
<dt><code>--no-vcs-ignore</code></dt><dd><p>Skip loading of version control system (VCS) ignore files. By default, watchexec loads .gitignore files in the current directory (or parent directories) and uses them to populate the ignore list.</p></dd>
<dt><code>--no-default-ignore</code></dt><dd><p>Skip default ignore statements. By default, watchexec ignores common temporary files for you, for example <code>*.swp</code>, <code>*.pyc</code>, and <code>.DS_Store</code></p></dd>
</dl>
@ -135,7 +136,7 @@
<ol class='man-decor man-foot man foot'>
<li class='tl'></li>
<li class='tc'>February 2017</li>
<li class='tc'>April 2017</li>
<li class='tr'>watchexec(1)</li>
</ol>

View File

@ -3,7 +3,7 @@ watchexec(1) -- execute commands when watched files change
## SYNOPSIS
watchexec [`--exts` | `-e` <extensions>]... [`--filter` | `-f` <pattern>]... [`--ignore` | `-i` <pattern>]... [`--watch` | `-w` <path>]... [`--restart` | `-r`] [`--clear` | `-c`] [`--postpone` | `-p`] [`--force-poll` <interval>] [`--debug` | `-d`] [`--no-vcs-ignore`] <command> [<argument>...]
watchexec [`--exts` | `-e` <extensions>]... [`--filter` | `-f` <pattern>]... [`--ignore` | `-i` <pattern>]... [`--watch` | `-w` <path>]... [`--restart` | `-r`] [`--clear` | `-c`] [`--postpone` | `-p`] [`--force-poll` <interval>] [`--debug` | `-d`] [`--no-vcs-ignore`] [`--no-default-ignore`] <command> [<argument>...]
## DESCRIPTION
@ -52,6 +52,9 @@ Poll for changes every <interval> ms instead of using system-specific notificati
* `--no-vcs-ignore`:
Skip loading of version control system (VCS) ignore files. By default, watchexec loads .gitignore files in the current directory (or parent directories) and uses them to populate the ignore list.
* `--no-default-ignore`:
Skip default ignore statements. By default, watchexec ignores common temporary files for you, for example `*.swp`, `*.pyc`, and `.DS_Store`
## ENVIRONMENT
Processes started by watchexec have the `$WATCHEXEC_UPDATED_PATH` environment variable set to the path of the first modification observed. In addition, the `$WATCHEXEC_COMMON_PATH` environment variable is set to the common path of all observed modifications.

View File

@ -95,6 +95,9 @@ pub fn get_args() -> Args {
.arg(Arg::with_name("no-vcs-ignore")
.help("Skip auto-loading of .gitignore files for filtering")
.long("no-vcs-ignore"))
.arg(Arg::with_name("no-default-ignore")
.help("Skip auto-ignoring of commonly ignored globs")
.long("no-default-ignore"))
.arg(Arg::with_name("postpone")
.help("Wait until first change to execute command")
.short("p")
@ -139,7 +142,10 @@ pub fn get_args() -> Args {
String::from("*.pyc"),
String::from("*.swp")];
ignores.extend(default_ignores);
if args.occurrences_of("no-default-ignore") == 0 {
ignores.extend(default_ignores)
};
ignores.extend(values_t!(args.values_of("ignore"), String).unwrap_or(vec![]));
let poll_interval = if args.occurrences_of("poll") > 0 {