bee-tui 1.0.0

Production-grade k9s-style terminal cockpit for Ethereum Swarm Bee node operators.
Documentation
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}"
    )
}