case

Function case 

Source
pub async fn case<'a, I, W, P, S, E>(
    word: W,
    arms: I,
    env: &mut E,
) -> Result<BoxFuture<'static, ExitStatus>, S::Error>
where I: Iterator<Item = PatternBodyPair<&'a [P], S>>, W: WordEval<E>, P: 'a + WordEval<E>, P::Error: IsFatalError, S: Spawn<E>, S::Error: From<W::Error> + From<P::Error>, E: ?Sized + LastStatusEnvironment + ReportErrorEnvironment,
Expand description

Spawns a case commands from a word to match number of case arms.

First the provided word will be evaluated and compared to each pattern of each case arm. The first arm which contains a pattern that matches the word will have its (and only its) body evaluated.

If no arms are matched, the case command will exit successfully.