foundry_cli/opts/
shell.rsuse clap::Parser;
use foundry_common::shell::{ColorChoice, Shell, Verbosity};
#[derive(Clone, Copy, Debug, Parser)]
pub struct ShellOpts {
#[clap(long, global = true, conflicts_with = "quiet", help_heading = "Display options")]
pub verbose: bool,
#[clap(
short,
long,
global = true,
alias = "silent",
conflicts_with = "verbose",
help_heading = "Display options"
)]
pub quiet: bool,
#[clap(long, global = true, value_enum, help_heading = "Display options")]
pub color: Option<ColorChoice>,
}
impl ShellOpts {
pub fn shell(self) -> Shell {
let verbosity = match (self.verbose, self.quiet) {
(true, false) => Verbosity::Verbose,
(false, true) => Verbosity::Quiet,
(false, false) => Verbosity::Normal,
(true, true) => unreachable!(),
};
Shell::new_with(self.color.unwrap_or_default(), verbosity)
}
}