2024-11-14 13:46:38 +01:00
|
|
|
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: f32,
|
|
|
|
|
|
|
|
/// Frame rate, i.e. number of frames per second
|
|
|
|
#[arg(short, long, value_name = "FLOAT", default_value_t = 60.0)]
|
|
|
|
pub frame_rate: f32,
|
|
|
|
|
|
|
|
/// RPC Endpoint to the nodes JSON RPC
|
2024-11-24 17:01:41 +01:00
|
|
|
#[arg(short, long, default_value_t = String::from("ws://localhost:9945"))]
|
2024-11-14 13:46:38 +01:00
|
|
|
pub rpc_endpoint: String,
|
|
|
|
|
|
|
|
/// Request timeout in seconds
|
|
|
|
#[arg(short = 'i', long, default_value_t = 2)]
|
|
|
|
pub timeout: u64,
|
|
|
|
|
|
|
|
/// Mouse usage during execution, EXPERIMENTAL AND NOT RECOMENDED
|
|
|
|
#[arg(short, long)]
|
|
|
|
pub mouse_needed: bool,
|
|
|
|
|
|
|
|
/// Paste available during execution, EXPERIMENTAL AND NOT RECOMENDED
|
|
|
|
#[arg(short, long)]
|
|
|
|
pub paste_needed: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
const VERSION_MESSAGE: &str = concat!(
|
|
|
|
env!("CARGO_PKG_VERSION"),
|
|
|
|
"-",
|
|
|
|
env!("VERGEN_GIT_DESCRIBE"),
|
|
|
|
" (",
|
|
|
|
env!("VERGEN_BUILD_DATE"),
|
|
|
|
")",
|
|
|
|
);
|
|
|
|
|
|
|
|
fn version() -> String {
|
|
|
|
let author = clap::crate_authors!();
|
|
|
|
|
|
|
|
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}"
|
|
|
|
)
|
|
|
|
}
|