Add clap‑based CLI with subcommands (gpu, battery, power, status), verbose flag, and detailed options such as rtd3, use_nvidia_current, etc. - New Features - New CLI entry point with complete subcommand hierarchy - Verbose logging support - Granular command options for GPU, Battery, Power, Status - Enhancements - Replace placeholder hello world with proper logging initialization - Modularize command implementations into dedicated modules
32 lines
710 B
Rust
32 lines
710 B
Rust
use clap::Parser;
|
|
|
|
mod cli;
|
|
mod commands;
|
|
mod hardware;
|
|
mod utils;
|
|
|
|
use cli::{Cli, Commands};
|
|
|
|
fn main() {
|
|
let cli = Cli::parse();
|
|
|
|
let level = if cli.verbose {
|
|
log::LevelFilter::Debug
|
|
} else {
|
|
log::LevelFilter::Info
|
|
};
|
|
|
|
env_logger::Builder::new()
|
|
.filter_level(level)
|
|
.format_timestamp(None)
|
|
.format_module_path(false)
|
|
.init();
|
|
|
|
match &cli.command {
|
|
Commands::Gpu { command } => commands::gpu::execute(command),
|
|
Commands::Battery { command } => commands::battery::execute(command),
|
|
Commands::Power { command } => commands::power::execute(command),
|
|
Commands::Status => commands::status::execute(),
|
|
}
|
|
}
|