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
use clap::Parser;
use crate::config::{get_config_dir, get_data_dir};
#[derive(Parser, Debug)]
#[command(author, version = version(), about)]
pub struct Cli {
/// Tick rate, i.e. number of ticks per second
#[arg(short, long, value_name = "FLOAT", default_value_t = 4.0)]
pub tick_rate: f64,
/// Frame rate, i.e. number of frames per second
#[arg(short, long, value_name = "FLOAT", default_value_t = 60.0)]
pub frame_rate: f64,
/// Render with ASCII glyphs only — no Unicode (✓ ⚠ ✗ ▶ ▇ …).
/// Use on terminals with poor Unicode support: Windows Terminal
/// pre-Win11, screen readers, some SSH chains. Equivalent to
/// setting `[ui].ascii_fallback = true` in `config.toml`.
#[arg(long)]
pub ascii: bool,
/// Suppress colour output regardless of the configured theme.
/// Equivalent to setting `[ui].theme = "mono"` in `config.toml`,
/// or to `NO_COLOR=1` in the environment (which is also honoured
/// automatically per <https://no-color.org>).
#[arg(long)]
pub no_color: bool,
}
const VERSION_MESSAGE: &str = concat!(
env!("CARGO_PKG_VERSION"),
"-",
env!("VERGEN_GIT_DESCRIBE"),
" (",
env!("VERGEN_BUILD_DATE"),
")"
);
pub fn version() -> String {
let author = clap::crate_authors!();
// let current_exe_path = PathBuf::from(clap::crate_name!()).display().to_string();
let config_dir_path = get_config_dir().display().to_string();
let data_dir_path = get_data_dir().display().to_string();
format!(
"\
{VERSION_MESSAGE}
Authors: {author}
Config directory: {config_dir_path}
Data directory: {data_dir_path}"
)
}