OSDN Git Service

Regular updates
[twpd/master.git] / watchexec.md
1 ---
2 title: Watchexec
3 layout: 2017/sheet
4 updated: 2017-10-18
5 category: CLI
6 weight: -1
7 keywords:
8   - "watchexec --excts js,jsx -- npm test"
9   - "watchexec --help"
10 intro: |
11   [mattgreen/watchexec](https://github.com/mattgreen/watchexec) runs commands whenever certain files change.
12 ---
13
14 ### Installation
15
16 #### OSX
17
18 ```bash
19 brew install watchexec
20 ```
21
22 #### Rust
23
24 ```bash
25 cargo install watchexec
26 ```
27
28 For Linux and Windows, get it from [GitHub releases](https://github.com/mattgreen/watchexec).
29
30 ### Getting started
31
32 ```bash
33 watchexec --exts js,jsx -- npm test
34 ```
35
36 Runs `npm test` when `js,jsx` files change.
37
38 ```bash
39 watchman -w lib -w test -- npm test
40 ```
41
42 Runs `npm test` when `lib/` and `test/` files change.
43
44 ### Other options
45
46 #### Flags
47
48 | `-c` `--clear`   | Clear screen                         |
49 | `-r` `--restart` | Restart process if its still running |
50
51 #### Options
52
53 | `-s` `--signal SIGKILL` | Kill signal to use            |
54 | `-d` `--debounce MS`    | Debounce by `MS` milliseconds |
55 | `-e` `--exts EXTS`      | Extensions                    |
56 | `-i` `--ignore PATTERN` | Ignore these files            |
57 | `-w` `--watch PATH`     | Watch these directories       |
58
59 ## Also see
60
61 * [mattgreen/watchexec](https://github.com/mattgreen/watchexec) _(github.com)_