rustutils_false/
lib.rs

1use clap::Parser;
2use rustutils_runnable::Runnable;
3use std::error::Error;
4use std::process::ExitCode;
5
6/// Exit with a status code indicating failure.
7#[derive(Parser, Clone, Debug)]
8#[clap(author, version, about, long_about = None)]
9pub struct False {
10    #[clap(long, short)]
11    code: Option<u8>,
12}
13
14impl Runnable for False {
15    fn run(&self) -> Result<(), Box<dyn Error>> {
16        Ok(())
17    }
18
19    fn main(&self) -> ExitCode {
20        match self.code {
21            None => ExitCode::FAILURE,
22            Some(code) => ExitCode::from(code),
23        }
24    }
25}