ghost-eye/src/cli.rs
Uncle Stretch 73db8ca32a
integration of subxt dependency
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2024-11-24 19:01:41 +03:00

58 lines
1.4 KiB
Rust

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
#[arg(short, long, default_value_t = String::from("ws://localhost:9945"))]
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}"
)
}