feat: add cpu name info option

This commit is contained in:
Adrian Groh 2023-05-20 15:48:22 +02:00
parent a8b69d36ef
commit ea6b78db16
Signed by: Gobidev
GPG Key ID: 3AA3153E98B0D771
3 changed files with 8 additions and 1 deletions

View File

@ -97,7 +97,7 @@ make your changes to `./pfetch-extractor/logos.sh` and build the binary with
# Default: first example below # Default: first example below
# Valid: space separated string # Valid: space separated string
# #
# OFF by default: shell editor wm de palette # OFF by default: shell editor wm de palette cpu
PF_INFO="ascii title os host kernel uptime pkgs memory" PF_INFO="ascii title os host kernel uptime pkgs memory"
# Example: Only ASCII. # Example: Only ASCII.

View File

@ -230,6 +230,10 @@ pub fn memory(memory_readout: &MemoryReadout) -> Option<String> {
} }
} }
pub fn cpu(general_readout: &GeneralReadout) -> Option<String> {
general_readout.cpu_model_name().ok()
}
pub fn os(general_readout: &GeneralReadout) -> Option<String> { pub fn os(general_readout: &GeneralReadout) -> Option<String> {
match env::consts::OS { match env::consts::OS {
"linux" => { "linux" => {

View File

@ -13,6 +13,7 @@ enum PfetchInfo {
Kernel, Kernel,
Uptime, Uptime,
Pkgs, Pkgs,
Cpu,
Memory, Memory,
Shell, Shell,
Editor, Editor,
@ -40,6 +41,7 @@ impl FromStr for PfetchInfo {
"kernel" => Ok(PfetchInfo::Kernel), "kernel" => Ok(PfetchInfo::Kernel),
"uptime" => Ok(PfetchInfo::Uptime), "uptime" => Ok(PfetchInfo::Uptime),
"pkgs" => Ok(PfetchInfo::Pkgs), "pkgs" => Ok(PfetchInfo::Pkgs),
"cpu" => Ok(PfetchInfo::Cpu),
"memory" => Ok(PfetchInfo::Memory), "memory" => Ok(PfetchInfo::Memory),
"shell" => Ok(PfetchInfo::Shell), "shell" => Ok(PfetchInfo::Shell),
"editor" => Ok(PfetchInfo::Editor), "editor" => Ok(PfetchInfo::Editor),
@ -180,6 +182,7 @@ fn get_info(
pfetch::total_packages(&readouts.package_readout, skip_slow_package_managers) pfetch::total_packages(&readouts.package_readout, skip_slow_package_managers)
.to_string(), .to_string(),
), ),
PfetchInfo::Cpu => pfetch::cpu(&readouts.general_readout),
PfetchInfo::Memory => pfetch::memory(&readouts.memory_readout), PfetchInfo::Memory => pfetch::memory(&readouts.memory_readout),
PfetchInfo::Shell => pfetch::shell(&readouts.general_readout), PfetchInfo::Shell => pfetch::shell(&readouts.general_readout),
PfetchInfo::Editor => pfetch::editor(), PfetchInfo::Editor => pfetch::editor(),