mirror of
https://github.com/watchexec/watchexec.git
synced 2024-09-29 14:41:35 +02:00
Option to run command initially, before first file change (fixes #12)
This commit is contained in:
parent
dde7453a47
commit
6887552aab
@ -71,6 +71,9 @@ fn get_args<'a>() -> ArgMatches<'a> {
|
|||||||
.arg(Arg::with_name("no-vcs-ignore")
|
.arg(Arg::with_name("no-vcs-ignore")
|
||||||
.help("Skip auto-loading of .gitignore files for filtering")
|
.help("Skip auto-loading of .gitignore files for filtering")
|
||||||
.long("no-vcs-ignore"))
|
.long("no-vcs-ignore"))
|
||||||
|
.arg(Arg::with_name("run-initially")
|
||||||
|
.help("Run command initially, before first file change")
|
||||||
|
.long("run-initially"))
|
||||||
.get_matches()
|
.get_matches()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,6 +156,9 @@ fn main() {
|
|||||||
let mut runner = Runner::new(args.is_present("restart"), args.is_present("clear"));
|
let mut runner = Runner::new(args.is_present("restart"), args.is_present("clear"));
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
if args.is_present("run-initially") {
|
||||||
|
runner.run_command(&cmd);
|
||||||
|
}
|
||||||
let e = wait(&rx, &filter).expect("error when waiting for filesystem changes");
|
let e = wait(&rx, &filter).expect("error when waiting for filesystem changes");
|
||||||
|
|
||||||
debug!("{:?}: {:?}", e.op, e.path);
|
debug!("{:?}: {:?}", e.op, e.path);
|
||||||
|
Loading…
Reference in New Issue
Block a user