fix: 🐛 Minor fixes

This commit is contained in:
Atsukoro1 2022-12-05 20:37:10 +01:00
parent f93ea3d3c0
commit 04646be77a
6 changed files with 27 additions and 16 deletions

View file

@ -94,7 +94,7 @@ impl Arguments {
} }
if args.pony == "" { if args.pony == "" {
args.pony = String::from("rainbowdash"); args.pony = String::from("rainbowdash_large");
} }
if args.help { if args.help {

View file

@ -1,5 +1,7 @@
#[cfg(target_os = "linux")]
use std::{fs::File, io::Read}; use std::{fs::File, io::Read};
#[cfg(target_os = "linux")]
pub fn file_open(path: &str) -> String { pub fn file_open(path: &str) -> String {
let mut temp_buf: String = String::new(); let mut temp_buf: String = String::new();

View file

@ -10,14 +10,18 @@ pub fn get_pony(name: String) -> Option<Pony> {
("applejack_large", include_bytes!("../../ponies/applejack_large.txt").to_vec()), ("applejack_large", include_bytes!("../../ponies/applejack_large.txt").to_vec()),
("celestia_large", include_bytes!("../../ponies/celestia_large.txt").to_vec()), ("celestia_large", include_bytes!("../../ponies/celestia_large.txt").to_vec()),
("fluttershy_large", include_bytes!("../../ponies/fluttershy_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()), ("fluttershy", include_bytes!("../../ponies/fluttershy.txt").to_vec()),
("luna_large", include_bytes!("../../ponies/luna_large.txt").to_vec()), ("luna_large", include_bytes!("../../ponies/luna_large.txt").to_vec()),
("mcintosh_large", include_bytes!("../../ponies/mcintosh_large.txt").to_vec()), ("mcintosh_large", include_bytes!("../../ponies/mcintosh_large.txt").to_vec()),
("pinkiepie_large", include_bytes!("../../ponies/pinkiepie_large.txt").to_vec()), ("pinkiepie_large", include_bytes!("../../ponies/pinkiepie_large.txt").to_vec()),
("rainbowdash_large", include_bytes!("../../ponies/rainbowdash_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()), ("rainbowdash", include_bytes!("../../ponies/rainbowdash.txt").to_vec()),
#[cfg(target_os = "linux")]
("rarity", include_bytes!("../../ponies/rarity.txt").to_vec()), ("rarity", include_bytes!("../../ponies/rarity.txt").to_vec()),
("twilight_large", include_bytes!("../../ponies/twilight_large.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()), ("twilight", include_bytes!("../../ponies/twilight.txt").to_vec()),
]); ]);

View file

@ -1,5 +1,8 @@
use super::colors::print; 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) { pub fn print_detail(title: &str, value: String, atype: ActionType, color: &str) {
print!(" "); print!(" ");
@ -47,5 +50,12 @@ pub fn print_ponyline(line: u16, pony: &str, color: &str) {
let mut lines = pony.split("\n"); let mut lines = pony.split("\n");
let line = lines.nth(line as usize).unwrap().to_string(); let line = lines.nth(line as usize).unwrap().to_string();
print(&line, true, color); print(
&format!("{:?}", line)
.replace("\"", "")
.replace("\\r", "")
,
true,
color
);
} }

View file

@ -131,15 +131,10 @@ pub fn get_hostname() -> String {
.to_string() .to_string()
} }
#[cfg(target_os = "linux")]
pub fn get_kernel() -> String { pub fn get_kernel() -> String {
let mut kernel = String::new(); 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") let output = Command::new("uname")
.args(&["-r"]) .args(&["-r"])
.output() .output()