Files
ember-tune-rs/src/cli.rs
2026-02-26 17:17:57 +01:00

67 lines
2.5 KiB
Rust

//! Defines the command-line interface for `ember-tune`.
//!
//! This module uses the `clap` crate to define the CLI arguments, subcommands,
//! and help text.
use clap::{Parser, builder::styling};
use std::path::PathBuf;
const STYLES: styling::Styles = styling::Styles::styled()
.header(styling::AnsiColor::Green.on_default().bold())
.usage(styling::AnsiColor::Green.on_default().bold())
.literal(styling::AnsiColor::Cyan.on_default().bold())
.placeholder(styling::AnsiColor::Cyan.on_default());
/// Scientifically-driven hardware power and thermal optimizer.
#[derive(Parser, Debug)]
#[command(
name = "ember-tune",
author = "Nils Pukropp <nils@narl.io>",
version = "1.1.0",
about = "ember-tune: A physically-grounded thermal and power optimizer for Linux.",
long_about = "ember-tune transforms manual laptop tuning into a rigorous, automated engineering workflow. \nIt executes a state machine to find the 'Physical Sweet Spot' of your specific hardware by measuring \nthe Silicon Knee, Thermal Resistance (Rθ), and Thermal Inertia, then outputs optimal \nconfigurations for tools like 'throttled' or 'i8kmon'.",
styles = STYLES,
after_help = "EXAMPLES:\n sudo ember-tune # Run standard optimization\n sudo ember-tune --audit-only # Validate system requirements only\n sudo ember-tune --mock # Safe demo with fake hardware"
)]
pub struct Cli {
/// Path to output the final `throttled.conf` file.
#[arg(
short,
long,
value_name = "THROTTLED_PATH",
help = "Optional: Overrides the discovered or default path for throttled.conf."
)]
pub config_out: Option<PathBuf>,
/// Maximum safe temperature (Celsius) for the benchmark.
#[arg(
short,
long,
default_value_t = 95.0,
help = "The emergency thermal cutoff. If any sensor hits this, the benchmark aborts instantly."
)]
pub max_temp: f32,
/// Enable verbose debug logging.
#[arg(
short,
long,
help = "Writes high-resolution diagnostic logs to /var/log/ember-tune.log"
)]
pub verbose: bool,
/// Use a mock hardware layer for safe testing.
#[arg(
long,
help = "Emulates hardware responses. Ideal for testing UI/Logic on unsupported systems."
)]
pub mock: bool,
/// Run pre-flight audit only, then exit.
#[arg(
long,
help = "Validate system requirements and conflicts without starting the benchmark."
)]
pub audit_only: bool,
}