Update cli readme

This commit is contained in:
Félix Saparelli 2021-12-29 22:06:50 +13:00
parent 7fa80f8715
commit 7fa657fc48
No known key found for this signature in database
GPG Key ID: B948C4BAE44FC474
1 changed files with 17 additions and 12 deletions

View File

@ -12,29 +12,34 @@ Example use cases:
* Simple invocation and use
* Runs on Linux, Mac, Windows, and more
* Monitors current directory and all subdirectories for changes
* Uses efficient event polling mechanism (on Linux, Mac, Windows)
* Uses efficient event polling mechanism (on Linux, Mac, Windows, BSD)
* Coalesces multiple filesystem events into one, for editors that use swap/backup files during saving
* By default, uses `.gitignore` and `.ignore` to determine which files to ignore notifications for
* By default, uses `.gitignore`, `.ignore`, and other such files to determine which files to ignore notifications for
* Support for watching files with a specific extension
* Support for filtering/ignoring events based on [glob patterns](https://docs.rs/globset/*/globset/#syntax)
* Launches the command in a new process group (can be disabled with `--no-process-group`)
* Sets the following environment variables in the process:
* If a single file changed (depending on the event type):
* `$WATCHEXEC_CREATED_PATH`, the path of the file that was created
* `$WATCHEXEC_REMOVED_PATH`, the path of the file that was removed
* `$WATCHEXEC_RENAMED_PATH`, the path of the file that was renamed
* `$WATCHEXEC_WRITTEN_PATH`, the path of the file that was modified
* `$WATCHEXEC_META_CHANGED_PATH`, the path of the file whose metadata changed
* If multiple files changed:
* `$WATCHEXEC_COMMON_PATH`, the longest common path of all of the files that triggered a change
* This can be disabled or limited with `--no-environment` and `--no-meta`
* Optionally clears screen between executions
* Optionally restarts the command with every modification (good for servers)
* Does not require a language runtime
* Sets the following environment variables in the process:
`$WATCHEXEC_COMMON_PATH` is set to the longest common path of all of the below variables, and so should be prepended to each path to obtain the full/real path.
| Variable name | Event kind |
|---|---|
| `$WATCHEXEC_CREATED_PATH` | files/folders were created |
| `$WATCHEXEC_REMOVED_PATH` | files/folders were removed |
| `$WATCHEXEC_RENAMED_PATH` | files/folders were renamed |
| `$WATCHEXEC_WRITTEN_PATH` | files/folders were modified |
| `$WATCHEXEC_META_CHANGED_PATH` | files/folders' metadata were modified |
| `$WATCHEXEC_OTHERWISE_CHANGED_PATH` | every other kind of event |
This can be disabled or limited with `--no-environment` (doesn't set any of these variables) and `--no-meta` (ignores metadata changes).
## Anti-Features
* Not tied to any particular language or ecosystem
* Not tied to Git or the presence of a repository/project
* Does not require a cryptic command line involving `xargs`
## Usage Examples