use std::path::PathBuf; use clap::Parser; use crate::config::{get_config_dir, get_data_dir}; #[derive(Parser, Debug)] #[command(author, version = version(), about)] pub struct Cli { /// File to edit. A path that does not exist is created on write. // MJB-LLR-111, MJB-LLR-112 #[arg(value_name = "FILE")] pub file: Option, /// 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, } const VERSION_MESSAGE: &str = concat!( env!("CARGO_PKG_VERSION"), "-", env!("VERGEN_GIT_DESCRIBE"), " (", env!("VERGEN_BUILD_DATE"), ")" ); /// The `origin` remote of the checkout this binary was built from, emitted by /// `build.rs`. const GIT_REMOTE_URL: &str = env!("VERGEN_GIT_REMOTE_URL"); 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} Repository: {GIT_REMOTE_URL} Config directory: {config_dir_path} Data directory: {data_dir_path}" ) }