diff --git a/ark-cli/src/main.rs b/ark-cli/src/main.rs index 9d5adfbe..c475a175 100644 --- a/ark-cli/src/main.rs +++ b/ark-cli/src/main.rs @@ -452,6 +452,11 @@ async fn main() -> anyhow::Result<()> { let img = render_preview_page(buf, quality); img.save(dest_path).unwrap(); } + Command::Watch { path } => { + let canonicalized_path = std::fs::canonicalize(path.clone())?; + println!("Watching path: {:?}", canonicalized_path); + fs_index::watch::watch_index(path.clone()).await?; + } Command::Link(link) => match &link { Link::Create { root_dir, diff --git a/ark-cli/src/models/cli.rs b/ark-cli/src/models/cli.rs index 3e66ed3f..b3740a91 100644 --- a/ark-cli/src/models/cli.rs +++ b/ark-cli/src/models/cli.rs @@ -88,6 +88,18 @@ pub enum Command { filter: Option, }, + #[clap( + about = "Watch a directory for changes and update the index automatically" + )] + Watch { + #[clap( + help = "Path to the directory to watch for changes", + default_value = ".", + value_parser + )] + path: PathBuf, + }, + #[clap(subcommand)] Link(Link),