use std::process;
use clap::Parser;
use tracing::error;
#[derive(Parser, Debug, Clone, Copy)]
#[allow(clippy::struct_excessive_bools)]
#[command(version, about)]
pub struct CliArgs {
#[clap(short = 'd', value_name = "ms", default_value_t = 1000)]
pub docker_interval: u32,
#[clap(short = 't')]
pub timestamp: bool,
#[clap(short = 'c', conflicts_with = "raw")]
pub color: bool,
#[clap(short = 'r', conflicts_with = "color")]
pub raw: bool,
#[clap(short = 's')]
pub show_self: bool,
#[clap(short = 'g')]
pub gui: bool,
}
impl CliArgs {
pub fn new() -> Self {
let args = Self::parse();
if args.docker_interval == 0 {
error!("docker args needs to be greater than 0");
process::exit(1)
}
Self {
color: args.color,
docker_interval: args.docker_interval,
gui: !args.gui,
show_self: !args.show_self,
raw: args.raw,
timestamp: !args.timestamp,
}
}
}