idx watch

For filesystem.

Stream filesystem change events from the live idx index.

Command Type

built-in

Signature

> idx watch {flags} (pattern)

Flags

  • --ignore, -i {list<string>}: List of globs or path-prefixes to exclude.
  • --timeout, -t {duration}: Stop streaming after this duration.
  • --max-events, -n {int}: Stop after emitting this many events.

Parameters

  • pattern: Base-relative glob, path, or directory to watch. Omit or pass empty to watch the whole indexed tree.

Input/output types:

input output
nothing table<kind: string, path: string>

Examples

Watch the whole indexed tree after initializing idx.

> idx init .; idx watch

Watch only Rust files, ignoring a vendor-style path prefix.

> idx watch "**/*.rs" --ignore [target]

Take action on modified files in a pipeline.

> idx watch | where kind == "modified" | each { |e| print $"changed: ($e.path)" }

Stop after a single event (useful in scripts).

> idx watch --max-events 1

Stop after a duration if no more events are needed.

> idx watch --timeout 5sec

Notes

Requires a live runtime initialized without --no-watch. Events are debounced by fff-search and emitted as records with kind (created, modified, removed, rescan) and absolute path. Gitignored and other index-ignored files do not produce events. Patterns must be inside the indexed base path. Use plain watch for ad-hoc path watching without an index.

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.