pw_watch CLI reference#

Embedded development file system watcher

usage: pw watch [-h] [-C directory [target ...]]
                [--build-system-command directory command]
                [--run-command RUN_COMMAND] [-j JOBS] [-k] [--parallel]
                [--parallel-workers PARALLEL_WORKERS] [--logfile LOGFILE]
                [--separate-logfiles] [--debug-logging] [--banners]
                [--no-banners] [--colors] [--no-colors] [--patterns PATTERNS]
                [--ignore-patterns IGNORE_PATTERNS_STRING]
                [--exclude-list EXCLUDE_LIST [EXCLUDE_LIST ...]]
                [--no-restart] [--serve-docs]
                [--serve-docs-port SERVE_DOCS_PORT]
                [--serve-docs-path SERVE_DOCS_PATH] [-f]
                [target [target ...]]

Build Directory and Command Options#

-C, --build-directory

Specify a build directory and optionally targets to build. pw watch -C out target1 target2 is equivalent to ‘ninja -C out taret1 target2’. The ‘out’ directory will be used if no others are provided.

Default: []


Default build targets. For example if the build directory is ‘out’ then, ‘ninja -C out taret1 target2’ will be run. To specify one or more directories, use the -C / --build-directory option.

Default: []


Build system command for . Default: ninja

Default: []


Additional commands to run. These are run before any -C arguments and may be repeated. For example: –run-command ‘bazel build //pw_cli/…’ –run-command ‘bazel test //pw_cli/…’ -C out python.lint python.test

Default: []

Build Execution Options#

-j, --jobs

Specify the number of cores to use for each build system. This is passed to ninja, bazel and make as “-j”

-k, --keep-going

Keep building past the first failure. This is equivalent to running “ninja -k 0” or “bazel build -k”.


Run all builds in parallel.


How many builds may run at the same time when –parallel is enabled. Default: 0 meaning run all in parallel.

Default: 0

Log File Options#


Global build output log file.


Create separate log files per build directory.


Enable Python build execution tool debug logging.

Display Output Options#


Show pass/fail banners.


Hide pass/fail banners.


Force color output from ninja.


Don’t force ninja to use color output.

Watch Options#


Comma delimited list of globs to watch to trigger recompile.

Default: “.bloaty,.c,*.cc,*.css,*.cpp,*.cmake,CMakeLists.txt,*.dts,*.dtsi,*.gn,*.gni,*.go,*.h,*.hpp,*.html,*.js,*.ld,*.md,*.options,*.proto,*.py,*.rs,*.rst,*.s,*.S,*.toml,*.ts”


Comma delimited list of globs to ignore events from.


Directories to ignore during pw watch. This option may be repeated. Directories are passed as separate arguments.

Default: []


Do not restart ongoing builds if files change.


Start a webserver for docs on localhost. The port for this webserver can be set with the –serve-docs-port option. Defaults to


Set the port for the docs webserver. Default: 8000.

Default: 8000


Set the path for the docs to serve. Default: docs/gen/docs in the build directory.

Default: docs/gen/docs

-f, --fullscreen

Use a fullscreen interface.