diff --git a/src/helpers/file.rs b/src/helpers/file.rs index 76b537c..a9059c2 100644 --- a/src/helpers/file.rs +++ b/src/helpers/file.rs @@ -7,13 +7,4 @@ pub fn file_open(path: &str) -> String { file.read_to_string(&mut temp_buf).unwrap(); temp_buf -} - -pub fn get_file_linecount(path: &str) -> u16 { - let mut temp_buf: String = String::new(); - - let mut file = File::open(path).unwrap(); - file.read_to_string(&mut temp_buf).unwrap(); - - temp_buf.lines().count() as u16 } \ No newline at end of file diff --git a/src/helpers/paths.rs b/src/helpers/paths.rs index 1b57440..413b04f 100644 --- a/src/helpers/paths.rs +++ b/src/helpers/paths.rs @@ -1,45 +1,17 @@ -use std::path::PathBuf; - -pub fn get_ponies() -> Vec { - let mut ponies: Vec = Vec::new(); - let pony_files = std::fs::read_dir(get_pony_path()).unwrap(); - - pony_files.for_each(|file| { - let file = file.unwrap(); - let file_name = file.file_name().into_string().unwrap(); - let file_name = file_name.split(".").collect::>()[0].to_string(); - ponies.push(file_name); - }); - - ponies -} - -#[cfg(target_os = "linux")] -pub fn get_pony_path() -> String { - if std::env::current_exe().unwrap().to_str().unwrap().contains("target") { - PathBuf::from("ponies/") - .to_str() - .unwrap() - .to_string() - } else { - PathBuf::from("/usr/share/ponyfetch/ponies/") - .to_str() - .unwrap() - .to_string() - } -} - -#[cfg(target_os = "windows")] -pub fn get_pony_path() -> String { - if std::env::current_exe().unwrap().to_str().unwrap().contains("target") { - PathBuf::from("ponies/") - .to_str() - .unwrap() - .to_string() - } else { - PathBuf::from("C:\\Program Files\\Ponyfetch\\ponies\\") - .to_str() - .unwrap() - .to_string() - } +pub fn get_ponies() -> Vec<&'static str> { + vec![ + "applejack_hat_large", + "applejack_large", + "celestia_large", + "fluttershy_large", + "fluttershy", + "luna_large", + "mcintosh_large", + "pinkiepie_large", + "rainbowdash_large", + "rainbowdash", + "rarity", + "twilight_large", + "twilight", + ] } \ No newline at end of file diff --git a/src/helpers/ponies.rs b/src/helpers/ponies.rs index a97a4f6..7192957 100644 --- a/src/helpers/ponies.rs +++ b/src/helpers/ponies.rs @@ -1,5 +1,4 @@ use std::collections::HashMap; - pub struct Pony { pub text: String, pub lines: u16 diff --git a/src/helpers/print.rs b/src/helpers/print.rs index 125dbc8..a004621 100644 --- a/src/helpers/print.rs +++ b/src/helpers/print.rs @@ -1,4 +1,4 @@ -use super::{file::file_open, colors::print}; +use super::colors::print; use crate::{helpers::{self}, ActionType}; pub fn print_detail(title: &str, value: String, atype: ActionType, color: &str) { diff --git a/src/main.rs b/src/main.rs index 6e46063..a13babc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,5 @@ -use std::collections::HashMap; - -use helpers::{arguments::Arguments, ponies::get_pony}; +use helpers::arguments::Arguments; +use helpers::ponies::get_pony; mod helpers; mod system; @@ -143,7 +142,7 @@ fn main() { args.color.as_str() ); }, - + ActionType::Details => { helpers::print::print_detail( ACTIONS[pad_i as usize].name.unwrap(), diff --git a/src/system/host.rs b/src/system/host.rs index 7c1dd2b..ba38e52 100644 --- a/src/system/host.rs +++ b/src/system/host.rs @@ -174,23 +174,6 @@ pub fn get_distro() -> String { distro.to_string() } -#[cfg(target_os = "linux")] -pub fn get_uptime() -> String { - let temp_buf: String = file_open("/proc/uptime"); - - let uptime: u128 = temp_buf.split(".") - .collect::>()[0] - .parse() - .unwrap(); - - let days = uptime / 86400; - let hours = (uptime % 86400) / 3600; - let minutes = (uptime % 3600) / 60; - let seconds = uptime % 60; - - format!("{}d {}h {}m {}s", days, hours, minutes, seconds) -} - #[cfg(target_os = "linux")] pub fn get_shell() -> String { let temp_buf: String = file_open("/etc/passwd");