Skip to main content

bee_tui/
cli.rs

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    /// Tick rate, i.e. number of ticks per second
9    #[arg(short, long, value_name = "FLOAT", default_value_t = 4.0)]
10    pub tick_rate: f64,
11
12    /// Frame rate, i.e. number of frames per second
13    #[arg(short, long, value_name = "FLOAT", default_value_t = 60.0)]
14    pub frame_rate: f64,
15}
16
17const VERSION_MESSAGE: &str = concat!(
18    env!("CARGO_PKG_VERSION"),
19    "-",
20    env!("VERGEN_GIT_DESCRIBE"),
21    " (",
22    env!("VERGEN_BUILD_DATE"),
23    ")"
24);
25
26pub fn version() -> String {
27    let author = clap::crate_authors!();
28
29    // let current_exe_path = PathBuf::from(clap::crate_name!()).display().to_string();
30    let config_dir_path = get_config_dir().display().to_string();
31    let data_dir_path = get_data_dir().display().to_string();
32
33    format!(
34        "\
35{VERSION_MESSAGE}
36
37Authors: {author}
38
39Config directory: {config_dir_path}
40Data directory: {data_dir_path}"
41    )
42}