This commit is contained in:
cool-mist
2025-08-23 01:00:51 +05:30
parent 71087ee90c
commit a38753393f
3 changed files with 48 additions and 256 deletions
+5 -3
View File
@@ -1,10 +1,9 @@
use clap::Parser;
use core::panic;
use json::JsonValue;
use std::process::Command;
fn main() {
let args = Cli::parse();
let args = argh::from_env::<Cli>();
if args.query == "cpu" {
let sensors = get_json_command_result(Command::new("sensors").arg("-j"));
let cpu_temp = &sensors["k10temp-pci-00c3"]["Tctl"]["temp1_input"];
@@ -23,8 +22,11 @@ fn main() {
println!("{}", gpu_temp);
}
#[derive(Parser)]
/// Command line interface for querying system temperatures.
#[derive(argh::FromArgs)]
struct Cli {
/// query type, either "cpu" or "gpu"
#[argh(positional)]
query: String,
}