use clap::{Parser, ValueHint};
use clio::Input;
use log::LevelFilter;
use crate::common::HasVerboseFlag;
use super::OutputFormat;
#[cfg(feature = "gzip")]
const BODYFILE_HELP: &str =
"path to input file or '-' for stdin (files ending with .gz will be treated as being gzipped)";
#[cfg(not(feature = "gzip"))]
const BODYFILE_HELP: &str = "path to input file or '-' for stdin";
#[derive(Parser)]
#[clap(name="mactime2", author, version, about, long_about = None)]
pub struct Cli {
#[clap(short('b'), num_args=1, value_parser, value_hint=ValueHint::FilePath, default_value="-", help=BODYFILE_HELP, display_order(100))]
pub(crate) input_file: Input,
#[clap(
short('F'),
num_args = 1,
long("format"),
value_enum,
display_order(600)
)]
pub(crate) output_format: Option<OutputFormat>,
#[clap(short('d'), num_args = 0, display_order(610))]
pub(crate) csv_format: bool,
#[clap(short('j'), num_args = 0, display_order(620))]
pub(crate) json_format: bool,
#[clap(short('f'), num_args = 1, long("from-timezone"), display_order(300))]
pub(crate) src_zone: Option<String>,
#[clap(short('t'), num_args = 1, long("to-timezone"), display_order(400))]
pub(crate) dst_zone: Option<String>,
#[clap(long("strict"), num_args = 0, display_order(500))]
pub(crate) strict_mode: bool,
#[clap(flatten)]
pub(crate) verbose: clap_verbosity_flag::Verbosity,
}
impl HasVerboseFlag for Cli {
fn log_level_filter(&self) -> LevelFilter {
self.verbose.log_level_filter()
}
}
impl Cli {
pub fn verbose(&self) -> &clap_verbosity_flag::Verbosity {
&self.verbose
}
pub fn src_zone(&self) -> &Option<String> {
&self.src_zone
}
pub fn dst_zone(&self) -> &Option<String> {
&self.dst_zone
}
}