Change Outcome::OrStart to the more flexible ::IfRunning

This commit is contained in:
Félix Saparelli 2021-08-22 20:47:47 +12:00
parent 656c0d8fd2
commit 53854d93d4
No known key found for this signature in database
GPG Key ID: B948C4BAE44FC474
1 changed files with 6 additions and 3 deletions

View File

@ -55,6 +55,7 @@ pub struct Action {
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum Outcome {
/// Stop processing this action silently.
DoNothing,
@ -68,9 +69,11 @@ pub enum Outcome {
/// Send this signal to the command.
Signal(Signal),
/// When command is running: do the inner outcome.
/// Otherwise: start the command.
OrStart(Box<Outcome>),
/// When command is running, do the first, otherwise the second.
IfRunning(Box<Outcome>, Box<Outcome>),
/// Clear the screen before doing the inner outcome.
ClearAnd(Box<Outcome>),
}
impl Default for Outcome {