1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
use crate::get_default_output_dir;
use clap::Parser;
use std::path::PathBuf;
use tracing_subscriber::filter::LevelFilter;

#[derive(Parser)]
pub struct CliOptions {
    #[arg(
        short,
        long,
        help = "The path (relative or absolute) to a scenario-specific JSON5 configuration file."
    )]
    pub config_file: Option<PathBuf>,
    #[arg(long, help = "A scenario configuration as a JSON5 string.")]
    pub config_string: Option<String>,
    #[arg(
        short = 'o',
        long = "output-dir",
        help = "Output base directory, relative or absolute.",
        default_value = get_default_output_dir().to_str().expect("will always be valid string")
    )]
    pub output_dir: PathBuf,
    #[arg(long = "dt", help = "Override the time step used for the simulation.")]
    pub dt: Option<f64>,
    #[arg(
        long = "max-steps",
        help = "Maximum number of simulation steps to take (by default infinite)"
    )]
    pub max_steps: Option<usize>,
    #[arg(
        long = "write-checkpoints",
        help = "Write a checkpoint file to disk after every timestep"
    )]
    pub write_checkpoints: bool,
    #[arg(
        long = "restore-checkpoint",
        help = "Restore the simulation state from a checkpoint file and continue the simulation"
    )]
    pub restore_checkpoint: Option<PathBuf>,
    #[arg(
        long,
        default_value = "info",
        help = "Log level to use for logging to the console. \
                Possible values: off, error, warn, info, debug, trace."
    )]
    pub console_log_level: LevelFilter,
    #[arg(
        long,
        default_value = "debug",
        help = "Log level to use for text and JSON log files. \
                Possible values: off, error, warn, info, debug, trace."
    )]
    pub file_log_level: LevelFilter,
    #[arg(
        long = "override",
        help = "Override a configuration option using the syntax <path.in.json>=<new value>. \
        Multiple overrides are applied in sequence."
    )]
    pub overrides: Vec<String>,
    #[arg(long = "compress-logs", help = "Compress logs with gzip compression.")]
    pub compress_logs: bool,
    #[arg(long = "no-archive", help = "Disable timestamped archive logs.", action = clap::ArgAction::SetFalse)]
    pub archive_logs: bool,
}