From 04646be77a582fbf7a931a6512b9ad471e7aa739 Mon Sep 17 00:00:00 2001 From: Atsukoro1 Date: Mon, 5 Dec 2022 20:37:10 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Minor=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ponies/rainbowdash_large.txt | 14 +++++++------- src/helpers/arguments.rs | 2 +- src/helpers/file.rs | 2 ++ src/helpers/ponies.rs | 4 ++++ src/helpers/print.rs | 14 ++++++++++++-- src/system/host.rs | 7 +------ 6 files changed, 27 insertions(+), 16 deletions(-) diff --git a/ponies/rainbowdash_large.txt b/ponies/rainbowdash_large.txt index d162564..9477732 100644 --- a/ponies/rainbowdash_large.txt +++ b/ponies/rainbowdash_large.txt @@ -1,20 +1,20 @@ __ __----__ / \__..--'' _-__''-_ ( / \ `-.''''` - | | `-..__ ., `. + | | `-..__ ., `. ___ ( '. \ ____`\ )`-_ `. - ___ ( `. '\ __/ __\' /-``-.._ \ + ___ ( `. '\ __/ __\' /-``-.._ \ ( `-. `. `. .|\_ ( / .-| |W)| `` `-. `-.`. `. |' ( ,'\ ( (WW| \` j - ..---'''''-`. `.\ _\ .| ', \_\_`/ ``-. - ,' _`-, ` ( | |' `. \__/ + ..---'''''-`. `.\ _\ .| ', \_\_`/ ``-. + ,' _`-, ` ( | |' `. \__/ / _ ( ``` __ \ \ | ._:7,______.-' | .-'/ `-._ ( `.\ '': \ / -'` / .-''>`-. `-. ` | | ( +'` / .-''>`-. `-. ` | | ( - / / `_: `_:. `. . \ \ | | | o()( ( \ )\ ; | - .' `. | Oo `---:.__-'') / )/ | - | | | ()o |/ ' | + .' `. | Oo `---:.__-'') / )/ | + | | | ()o |/ ' | .' |/ \ o / \__/ | , .| | /-,_______\ \ / / ) |' _/ / | |\ \ diff --git a/src/helpers/arguments.rs b/src/helpers/arguments.rs index b52567e..87f0c3c 100644 --- a/src/helpers/arguments.rs +++ b/src/helpers/arguments.rs @@ -94,7 +94,7 @@ impl Arguments { } if args.pony == "" { - args.pony = String::from("rainbowdash"); + args.pony = String::from("rainbowdash_large"); } if args.help { diff --git a/src/helpers/file.rs b/src/helpers/file.rs index a9059c2..e7bb472 100644 --- a/src/helpers/file.rs +++ b/src/helpers/file.rs @@ -1,5 +1,7 @@ +#[cfg(target_os = "linux")] use std::{fs::File, io::Read}; +#[cfg(target_os = "linux")] pub fn file_open(path: &str) -> String { let mut temp_buf: String = String::new(); diff --git a/src/helpers/ponies.rs b/src/helpers/ponies.rs index 256ae9d..881c4df 100644 --- a/src/helpers/ponies.rs +++ b/src/helpers/ponies.rs @@ -10,14 +10,18 @@ pub fn get_pony(name: String) -> Option { ("applejack_large", include_bytes!("../../ponies/applejack_large.txt").to_vec()), ("celestia_large", include_bytes!("../../ponies/celestia_large.txt").to_vec()), ("fluttershy_large", include_bytes!("../../ponies/fluttershy_large.txt").to_vec()), + #[cfg(target_os = "linux")] ("fluttershy", include_bytes!("../../ponies/fluttershy.txt").to_vec()), ("luna_large", include_bytes!("../../ponies/luna_large.txt").to_vec()), ("mcintosh_large", include_bytes!("../../ponies/mcintosh_large.txt").to_vec()), ("pinkiepie_large", include_bytes!("../../ponies/pinkiepie_large.txt").to_vec()), ("rainbowdash_large", include_bytes!("../../ponies/rainbowdash_large.txt").to_vec()), + #[cfg(target_os = "linux")] ("rainbowdash", include_bytes!("../../ponies/rainbowdash.txt").to_vec()), + #[cfg(target_os = "linux")] ("rarity", include_bytes!("../../ponies/rarity.txt").to_vec()), ("twilight_large", include_bytes!("../../ponies/twilight_large.txt").to_vec()), + #[cfg(target_os = "linux")] ("twilight", include_bytes!("../../ponies/twilight.txt").to_vec()), ]); diff --git a/src/helpers/print.rs b/src/helpers/print.rs index a004621..2659717 100644 --- a/src/helpers/print.rs +++ b/src/helpers/print.rs @@ -1,5 +1,8 @@ use super::colors::print; -use crate::{helpers::{self}, ActionType}; +use crate::{ + helpers::{self}, + ActionType +}; pub fn print_detail(title: &str, value: String, atype: ActionType, color: &str) { print!(" "); @@ -47,5 +50,12 @@ pub fn print_ponyline(line: u16, pony: &str, color: &str) { let mut lines = pony.split("\n"); let line = lines.nth(line as usize).unwrap().to_string(); - print(&line, true, color); + print( + &format!("{:?}", line) + .replace("\"", "") + .replace("\\r", "") + , + true, + color + ); } \ No newline at end of file diff --git a/src/system/host.rs b/src/system/host.rs index e039e1b..b87ad6c 100644 --- a/src/system/host.rs +++ b/src/system/host.rs @@ -131,15 +131,10 @@ pub fn get_hostname() -> String { .to_string() } +#[cfg(target_os = "linux")] pub fn get_kernel() -> String { let mut kernel = String::new(); - #[cfg(target_os = "windows")] - let output = Command::new("ver") - .output() - .expect("Failed to execute process"); - - #[cfg(target_os = "linux")] let output = Command::new("uname") .args(&["-r"]) .output()