Rename the command from 'watch-idle' to 'watch-when-idle'

This commit is contained in:
daubaris 2019-11-10 23:24:05 +02:00 committed by Félix Saparelli
parent de5ed1c2bd
commit 7ad8e78a34
2 changed files with 7 additions and 7 deletions

View File

@ -75,7 +75,7 @@ pub struct Args {
#[builder(default = "2")]
pub poll_interval: u32,
#[builder(default)]
pub watch_idle: bool,
pub watch_when_idle: bool,
}
impl ArgsBuilder {
@ -208,10 +208,10 @@ where
.short("n")
.long("no-shell"))
.arg(Arg::with_name("once").short("1").hidden(true))
.arg(Arg::with_name("watch-idle")
.arg(Arg::with_name("watch-when-idle")
.help("Ignores commands while the process is still running")
.short("W")
.long("watch-idle"));
.long("watch-when-idle"));
let args = match from {
None => app.get_matches(),
@ -306,6 +306,6 @@ where
once: args.is_present("once"),
poll: args.occurrences_of("poll") > 0,
poll_interval,
watch_idle: args.is_present("watch-idle"),
watch_when_idle: args.is_present("watch-when-idle"),
})
}

View File

@ -236,7 +236,7 @@ impl Handler for ExecHandler {
// Custom restart behaviour (--restart was given, and --signal specified):
// Send specified signal to the child, wait for it to exit, then run the command again
(true, true) => {
if self.args.watch_idle {
if self.args.watch_when_idle {
if !running_process {
self.spawn(ops)?;
}
@ -251,7 +251,7 @@ impl Handler for ExecHandler {
(true, false) => {
let sigterm = signal::new(Some("SIGTERM".into()));
if self.args.watch_idle {
if self.args.watch_when_idle {
if !running_process {
self.spawn(ops)?;
}
@ -268,7 +268,7 @@ impl Handler for ExecHandler {
// Default behaviour (neither --signal nor --restart specified):
// Make sure the previous run was ended, then run the command again
(false, false) => {
if self.args.watch_idle {
if self.args.watch_when_idle {
if !running_process {
self.spawn(ops)?;
}