diff --git a/README.md b/README.md index c0b2748..e4f38c6 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ make your changes to `./pfetch-extractor/logos.sh` and build the binary with # Default: first example below # 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" # Example: Only ASCII. diff --git a/src/lib.rs b/src/lib.rs index 5b93da9..3af9eb7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -230,6 +230,10 @@ pub fn memory(memory_readout: &MemoryReadout) -> Option { } } +pub fn cpu(general_readout: &GeneralReadout) -> Option { + general_readout.cpu_model_name().ok() +} + pub fn os(general_readout: &GeneralReadout) -> Option { match env::consts::OS { "linux" => { diff --git a/src/main.rs b/src/main.rs index b5ba98d..35211f4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,6 +13,7 @@ enum PfetchInfo { Kernel, Uptime, Pkgs, + Cpu, Memory, Shell, Editor, @@ -40,6 +41,7 @@ impl FromStr for PfetchInfo { "kernel" => Ok(PfetchInfo::Kernel), "uptime" => Ok(PfetchInfo::Uptime), "pkgs" => Ok(PfetchInfo::Pkgs), + "cpu" => Ok(PfetchInfo::Cpu), "memory" => Ok(PfetchInfo::Memory), "shell" => Ok(PfetchInfo::Shell), "editor" => Ok(PfetchInfo::Editor), @@ -180,6 +182,7 @@ fn get_info( pfetch::total_packages(&readouts.package_readout, skip_slow_package_managers) .to_string(), ), + PfetchInfo::Cpu => pfetch::cpu(&readouts.general_readout), PfetchInfo::Memory => pfetch::memory(&readouts.memory_readout), PfetchInfo::Shell => pfetch::shell(&readouts.general_readout), PfetchInfo::Editor => pfetch::editor(),