1
2use clap::{Parser};
3use crate::{OutputFormat};
4
5
6#[cfg(feature = "gzip")]
7const BODYFILE_HELP: &str = "path to input file or '-' for stdin (files ending with .gz will be treated as being gzipped)";
8#[cfg(not(feature = "gzip"))]
9const BODYFILE_HELP: &str = "path to input file or '-' for stdin";
10
11#[derive(Parser)]
12#[clap(author, version, about, long_about = None)]
13pub struct Cli {
14 #[clap(short('b'), default_value="-", help=BODYFILE_HELP, display_order(100))]
15 pub(crate) input_file: String,
16
17 #[clap(short('F'), long("format"), value_enum, display_order(600))]
19 pub(crate) output_format: Option<OutputFormat>,
20
21 #[clap(short('d'), display_order(610))]
24 pub(crate) csv_format: bool,
25
26 #[clap(short('j'), display_order(620))]
29 pub(crate) json_format: bool,
30
31 #[clap(short('f'), long("from-timezone"), display_order(300))]
33 pub(crate) src_zone: Option<String>,
34
35 #[clap(short('t'), long("to-timezone"), display_order(400))]
37 pub(crate) dst_zone: Option<String>,
38
39 #[clap(long("strict"), display_order(500))]
45 pub(crate) strict_mode: bool,
46
47 #[clap(flatten)]
48 pub(crate) verbose: clap_verbosity_flag::Verbosity,
49}
50
51impl Cli {
52 pub fn verbose(&self) -> &clap_verbosity_flag::Verbosity {
53 &self.verbose
54 }
55
56 pub fn src_zone(&self) -> &Option<String> {
57 &self.src_zone
58 }
59
60 pub fn dst_zone(&self) -> &Option<String> {
61 &self.dst_zone
62 }
63}