feat(src): Introduce full CLI interface for laptop hardware management
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
This commit is contained in:
2 files changed
+131
-1
No files matched your search
+29
-1
@@ -1,3 +1,31 @@
|
||||
use clap::Parser;
|
||||
|
||||
mod cli;
|
||||
mod commands;
|
||||
mod hardware;
|
||||
mod utils;
|
||||
|
||||
use cli::{Cli, Commands};
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
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(),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user