i try, and fail, to implement architecture detection

This commit is contained in:
SadlyNotSappho 2023-03-10 13:04:55 -08:00
parent ea593cffe5
commit 16f3dcce8e
3 changed files with 15 additions and 5 deletions

View File

@ -7,3 +7,6 @@ edition = "2021"
[dependencies] [dependencies]
dotenv-parser = "0.1.3" dotenv-parser = "0.1.3"
regex = "1.7.1"
serde = {version = "1.0.154", features = ["derive"]}
serde_json = "1.0.94"

View File

@ -1,9 +1,15 @@
use std::fs::read_to_string; use std::fs::read_to_string;
use dotenv_parser::parse_dotenv; use dotenv_parser::parse_dotenv;
pub fn get_os() { pub fn get_os() -> String {
let os_release = read_to_string("/etc/os-release").unwrap(); let os_release = read_to_string("/etc/os-release").unwrap();
let parsed = parse_dotenv(&os_release).unwrap(); let parsed = parse_dotenv(&os_release).unwrap();
println!("{}", parsed.get("PRETTY_NAME").unwrap()); parsed.get("PRETTY_NAME").unwrap().clone()
}
pub fn get_cpu() {
let binding = std::process::Command::new("lscpu").output().expect("lscpu failed");
let lscpu = String::from_utf8_lossy(&binding.stdout);
println!("{}", &lscpu)
} }

View File

@ -1,4 +1,5 @@
use gayfetch::get_os; use gayfetch::{get_os, get_cpu};
fn main() { fn main() {
get_os() let os = get_os();
let cpu = get_cpu();
} }