Added watchexec + cheat sheets
[webi-installers/.git] / watchexec / README.md
1 ---
2 title: watchexec
3 homepage: https://github.com/watchexec/watchexec
4 tagline: |
5   watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications.
6 ---
7
8 ### Updating `watchexec`
9
10 `webi watchexec@stable`
11
12 Use the `@beta` tag for pre-releases.
13
14 ## Cheat Sheet
15
16 Watch all JavaScript, CSS and HTML files in the current directory and all
17 subdirectories for changes, running `make` when a change is detected:
18
19     $ watchexec --exts js,css,html make
20
21 Call `make test` when any file changes in this directory/subdirectory, except
22 for everything below `target`:
23
24     $ watchexec -i target make test
25
26 Call `ls -la` when any file changes in this directory/subdirectory:
27
28     $ watchexec -- ls -la
29
30 Call/restart `python server.py` when any Python file in the current directory
31 (and all subdirectories) changes:
32
33     $ watchexec -e py -r python server.py
34
35 Call/restart `my_server` when any file in the current directory (and all
36 subdirectories) changes, sending `SIGKILL` to stop the child process:
37
38     $ watchexec -r -s SIGKILL my_server
39
40 Send a SIGHUP to the child process upon changes (Note: with using
41 `-n | --no-shell` here, we're executing `my_server` directly, instead of
42 wrapping it in a shell:
43
44     $ watchexec -n -s SIGHUP my_server
45
46 Run `make` when any file changes, using the `.gitignore` file in the current
47 directory to filter:
48
49     $ watchexec make
50
51 Run `make` when any file in `lib` or `src` changes:
52
53     $ watchexec -w lib -w src make
54
55 Run `bundle install` when the `Gemfile` changes:
56
57     $ watchexec -w Gemfile bundle install