Skip to main content Module watch Copy item path Source use super::build::BuildArgs ; π use super::coverage::CoverageArgs ; π use super::doc::DocArgs ; π use super::fmt::FmtArgs ; π use super::snapshot::GasSnapshotArgs ; π use super::test::TestArgs ; π use crate::opts::Forge ; π use alloy_primitives::map::HashMap; π use alloy_primitives::map::HashSet; π use clap::CommandFactory; π use clap::Parser; π use eyre::Result ; π use foundry_cli::utils ; π use foundry_cli::utils::FoundryPathExt ; π use foundry_cli::utils::LoadConfig ; π use foundry_config::Config ; π use parking_lot::Mutex; π use std::ffi::OsStr ; π use std::ffi::OsString ; π use std::io::IsTerminal ; π use std::path::PathBuf ; π use std::sync::Arc ; π use std::sync::OnceLock ; π use std::sync::Weak ; π use std::sync::atomic::AtomicU8 ; π use std::sync::atomic::Ordering ; π use std::time::Duration ; π use tokio::process::Command as TokioCommand; π use watchexec::Watchexec; π use watchexec::action::ActionHandler; π use watchexec::command::Command; π use watchexec::command::Program; π use watchexec::job::CommandState; π use watchexec::job::Job; π use watchexec::paths::summarise_events_to_env; π use watchexec_events::Event; π use watchexec_events::KeyCode; π use watchexec_events::Keyboard; π use watchexec_events::Priority; π use watchexec_events::ProcessEnd; π use watchexec_events::Tag; π use watchexec_events::filekind::AccessKind; π use watchexec_events::filekind::FileEventKind; π use watchexec_signals::Signal; π use yansi::Color; π use yansi::Paint; π WatchArgs KeyboardAction π TestRerun π How forge test --watch narrows the test command for one batch of events. WatchAction π What the watcher does with one batch of events. WatchFlag π How a command-line argument relates to the watch flag. changed_test_rerun π Picks the tests to run for changed files: the one changed test file, or the last test files
when only non-test files changed. clean_cmd_args π Removes the --watch flag from the args for the Watchexec command, so that the child command
does not enter watch mode itself and spawn another watcher. cmd_args π Returns the env args without the --watch flag from the args for the Watchexec command. command_options π Returns valueless short flags and variable-arity long options for the active command. end_of_process π has_file_events π Whether any of events is a filesystem event other than Access(Open). keyboard_action π looks_like_option π Returns whether arg looks like an option, which is where clap stops consuming the values of a
num_args(0..) argument. A lone - is a value. run Runs the given [watchexec::Config]. run_inner π set_keyboard_events π setup_process π short_watch_pos π Returns the byte index after w in a short flag cluster, if arg contains a watch flag. watch_action π Decides what the watcher does with a batch of events that came with signals. watch_build Executes a [Watchexec] that listens for changes in the projectβs src dir and reruns forge build watch_command π Converts a list of arguments to a watchexec::Command. watch_coverage watch_doc Executes a [Watchexec] that listens for changes affecting the generated
documentation: project sources, optionally library sources, the README that
becomes the homepage, the deployments directory, and the foundry config file
itself. Without these, the live preview goes silently stale on common edits. watch_flag π Returns how arg relates to the watch flag. watch_fmt watch_gas_snapshot Executes a [Watchexec] that listens for changes in the projectβs src dir and reruns forge snapshot watch_test Executes a [Watchexec] that listens for changes in the projectβs src dir and reruns forge test KeyboardConfig π SpawnHook π