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