-
Notifications
You must be signed in to change notification settings - Fork 2
docs: expand with-watch documentation #365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| # with-watch | ||
|
|
||
| `with-watch` is a Rust-based command rerun watcher that repeats a delegated command when its inferred or explicit filesystem inputs change. | ||
|
|
||
| ## Why use with-watch | ||
|
|
||
| - Keep familiar CLI tools such as `cat`, `cp`, `sed`, and `find`. | ||
| - Let `with-watch` infer watched inputs for common file-oriented commands. | ||
| - Declare explicit inputs with `exec --input` when you want fully predictable reruns. | ||
|
|
||
| ## Install | ||
|
|
||
| Tag contract: | ||
|
|
||
| - `with-watch@v<semver>` | ||
|
|
||
| Package manager: | ||
|
|
||
| - macOS/Linux: `brew install delinoio/tap/with-watch` | ||
|
|
||
| Cargo: | ||
|
|
||
| ```bash | ||
| cargo install with-watch | ||
| ``` | ||
|
|
||
| ## Quick start | ||
|
|
||
| Rerun a file reader when its input changes: | ||
|
|
||
| ```bash | ||
| with-watch cat input.txt | ||
| ``` | ||
|
|
||
| Watch the current directory with a safe pathless default: | ||
|
|
||
| ```bash | ||
| with-watch ls -l | ||
| ``` | ||
|
|
||
| Run a simple shell expression: | ||
|
|
||
| ```bash | ||
| with-watch --shell 'cat input.txt | grep hello' | ||
| ``` | ||
|
|
||
| Provide explicit inputs for an arbitrary command: | ||
|
|
||
| ```bash | ||
| with-watch exec --input 'src/**/*.rs' -- cargo test -p with-watch | ||
| ``` | ||
|
|
||
| ## Input inference model | ||
|
|
||
| - Passthrough mode and `--shell` use built-in command adapters first. | ||
| - Known outputs, inline scripts, and output redirects are filtered out of the watch set. | ||
| - Safe pathless defaults are intentionally narrow: `ls`, `dir`, `vdir`, `du`, and `find`. | ||
| - If `with-watch` cannot infer safe filesystem inputs, it fails instead of guessing. | ||
|
|
||
| ## When exec --input is required | ||
|
|
||
| Some commands do not expose meaningful filesystem inputs on their own. For example, `echo hello` has nothing safe to watch. | ||
|
|
||
| In those cases, use `exec --input` to declare the watch set explicitly: | ||
|
|
||
| ```bash | ||
| with-watch exec --input 'src/**/*.rs' -- cargo test -p with-watch | ||
| ``` | ||
|
|
||
| `with-watch` reruns the delegated command unchanged. It does not inject changed file paths into argv or environment variables. | ||
|
|
||
| ## Shell support boundaries | ||
|
|
||
| - `--shell` supports command-line expressions with `&&`, `||`, and `|`. | ||
| - Input redirects (`<`, `<>`) become watched inputs. | ||
| - Output redirects (`>`, `>>`, `&>`, `&>>`, `>|`) are treated as outputs and filtered from watching. | ||
| - Full shell control-flow is out of scope for v1. | ||
|
|
||
| ## Rerun behavior | ||
|
|
||
| - Default rerun filtering uses content hashes. | ||
| - `--no-hash` switches to metadata-only comparison. | ||
| - Self-mutating commands such as `sed -i.bak -e 's/old/new/' config.txt` refresh their baseline after each run so they do not loop on their own writes. | ||
| - Replace-style writers remain watchable because path inputs subscribe from the nearest existing directory anchor. | ||
|
|
||
| ## Related pages | ||
|
|
||
| - [Projects Overview](projects-overview) | ||
| - [Documentation Lifecycle](documentation-lifecycle) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--shellusageThis section describes
--shellsupport as if it is generally available, but the CLI explicitly errors on non-Unix systems (WithWatchError::ShellExecutionUnsupportedPlatformincrates/with-watch/src/error.rs). As written, Windows users following the new public quick-start/shell guidance will hit an immediate runtime failure, so this page should explicitly state the Unix-only platform boundary (matching the crate README).Useful? React with 👍 / 👎.