Cheat Sheet速查表
跳转到主要内容

Watchexec 速查表

本文根据 Devhints / Watchexec 翻译。代码示例及版本范围沿用原文。原文标注更新日期:2017-10-18。

mattgreen/watchexec 在特定文件发生更改时执行命令。

安装

OSX

brew install watchexec

Rust

cargo install watchexec

针对Linux 和 Windows,可从此处获取 当文件发生更改时,GitHub 会执行.

入门

watchexec --exts js,jsx -- npm test

运行 npm test 当 js,jsx 文件发生更改时。

watchman -w lib -w test -- npm test

运行 npm test 当 lib/ 以及 test/ 文件发生更改时。

其他选项 (Other options)

标志

-c --clear清屏
-r --restart如果 process 仍在运行,则将其重启

选项

-s --signal SIGKILL使用的终止信号
-d --debounce MS防抖(延迟)时间 MS 毫秒
-e --exts EXTS扩展名
-i --ignore PATTERN忽略这些文件
-w --watch PATH监视这些目录

另请参阅