1use clap::Parser;
2
3use crate::config::{get_config_dir, get_data_dir};
4
5#[derive(Parser, Debug)]
6#[command(author, version = version(), about)]
7pub struct Cli {
8 #[arg(short, long, value_name = "FLOAT", default_value_t = 4.0)]
10 pub tick_rate: f64,
11
12 #[arg(short, long, value_name = "FLOAT", default_value_t = 60.0)]
14 pub frame_rate: f64,
15
16 #[arg(long)]
21 pub ascii: bool,
22
23 #[arg(long)]
28 pub no_color: bool,
29}
30
31const VERSION_MESSAGE: &str = concat!(
32 env!("CARGO_PKG_VERSION"),
33 "-",
34 env!("VERGEN_GIT_DESCRIBE"),
35 " (",
36 env!("VERGEN_BUILD_DATE"),
37 ")"
38);
39
40pub fn version() -> String {
41 let author = clap::crate_authors!();
42
43 let config_dir_path = get_config_dir().display().to_string();
45 let data_dir_path = get_data_dir().display().to_string();
46
47 format!(
48 "\
49{VERSION_MESSAGE}
50
51Authors: {author}
52
53Config directory: {config_dir_path}
54Data directory: {data_dir_path}"
55 )
56}