58 lines
1.7 KiB
Rust
58 lines
1.7 KiB
Rust
// This file is part of Deja-Vu.
|
|
//
|
|
// Deja-Vu is free software: you can redistribute it and/or modify it
|
|
// under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// Deja-Vu is distributed in the hope that it will be useful, but
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
// See the GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Deja-Vu. If not, see <https://www.gnu.org/licenses/>.
|
|
//
|
|
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,
|
|
}
|
|
|
|
const VERSION_MESSAGE: &str = concat!(
|
|
env!("CARGO_PKG_VERSION"),
|
|
"-",
|
|
env!("VERGEN_GIT_DESCRIBE"),
|
|
" (",
|
|
env!("VERGEN_BUILD_DATE"),
|
|
")"
|
|
);
|
|
|
|
#[must_use]
|
|
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}"
|
|
)
|
|
}
|