slimm
This commit is contained in:
+5
-3
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user