feat(src/commands): add cooling profile descriptions and improve thermal detection

Implemented clearer cooling profile output by mapping mode codes to
human‑readable names and prefixing with "(ASUS)". Refactored thermal
detection loops for better readability and moved debug logging into the
correct block for GPU cache creation.

New Features
- Map mode strings "0","1","2" to readable cooling profile names
  (Performance, Balanced, Quiet / Battery Saving) and print them with
  "(ASUS)" label.
- Provide explicit cooling profile description in command output.

Enhancements
- Simplify Intel RAPL and AMD hwmon detection loops for clearer flow.
- Adjust brace placement in GPU cache creation to ensure debug log is
  emitted only on successful cache write.
- Minor formatting and style clean‑ups across battery, GPU, and power
  commands.

Bug Fixes
- Fix missing/incorrect closing braces in battery and power command
  parsers that previously caused compilation warnings.
- Ensure thermal detection logic only accesses sysfs entries after
  successful directory read.
This commit is contained in:
sankalp committed 2026-03-12 00:47:56 +05:45
1 parent 56a602e0a6
commit 857c7ebb28
4 files changed
+116 -111

No files matched your search

+4 -3
View File
@@ -270,9 +270,10 @@ fn create_cache_file() {
}
if let Ok(json) = serde_json::to_string_pretty(&cache)
&& fs::write(CACHE_FILE_PATH, json).is_ok() {
log::debug!("Created file {}", CACHE_FILE_PATH);
}
&& fs::write(CACHE_FILE_PATH, json).is_ok()
{
log::debug!("Created file {}", CACHE_FILE_PATH);
}
}
fn read_cache_file() -> Result<Cache, String> {