diff --git a/src/cli.rs b/src/cli.rs index e813d31..c8afc77 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -6,7 +6,6 @@ use clap::{App, Arg}; #[derive(Debug)] pub struct Args { pub cmd: String, - pub paths: Vec, pub filters: Vec, pub ignores: Vec, pub clear_screen: bool, @@ -34,13 +33,6 @@ pub fn get_args() -> Args { let args = App::new("watchexec") .version(crate_version!()) .about("Execute commands when watched files change") - .arg(Arg::with_name("path") - .help("Path to watch [default: .]") - .short("w") - .long("watch") - .number_of_values(1) - .multiple(true) - .takes_value(true)) .arg(Arg::with_name("command") .help("Command to execute") .multiple(true) @@ -92,7 +84,6 @@ pub fn get_args() -> Args { .get_matches(); let cmd = values_t!(args.values_of("command"), String).unwrap().join(" "); - let paths = values_t!(args.values_of("path"), String).unwrap_or(vec![String::from(".")]); let mut filters = values_t!(args.values_of("filter"), String).unwrap_or(vec![]); if let Some(extensions) = args.values_of("extensions") { @@ -121,7 +112,6 @@ pub fn get_args() -> Args { Args { cmd: cmd, - paths: paths, filters: filters, ignores: ignores, clear_screen: args.is_present("clear"), diff --git a/src/main.rs b/src/main.rs index 19deec4..0f17e41 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,10 +28,11 @@ mod watcher; use std::collections::HashMap; use std::env; +use std::path::Path; use std::sync::{Arc, RwLock}; use std::sync::mpsc::{channel, Receiver}; use std::time::Duration; -use std::path::{Path, PathBuf}; +use std::path::{PathBuf}; use notification_filter::NotificationFilter; use process::Process; @@ -119,15 +120,7 @@ fn main() { warn!("Polling for changes every {} ms", args.poll_interval); } - for path in args.paths { - match Path::new(&path).canonicalize() { - Ok(canonicalized) => watcher.watch(canonicalized).expect("unable to watch path"), - Err(_) => { - println!("invalid path: {}", path); - return; - } - } - } + watcher.watch(cwd).expect("unable to watch cwd"); // Start child process initially, if necessary if args.run_initially {