From bf36aaaf6fa57c2d7a5d50a0b94df4e9adb39099 Mon Sep 17 00:00:00 2001 From: candifloss Date: Thu, 15 Aug 2024 02:33:53 +0530 Subject: [PATCH] minor code formatting, cleanup --- src/main.rs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3516d86..25c1a3f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,7 @@ -use std::env::current_dir; -use std::env::var_os; -use std::env::args; +use std::env::{current_dir,var_os,args}; use std::path::PathBuf; +use colored::{Colorize,ColoredString}; //use std::ffi::OsString; -use colored::Colorize; -use colored::ColoredString; fn get_shell_char (shell: String) -> String { let shell_char = match shell.as_str() { @@ -36,13 +33,12 @@ fn abrev_path (pwd: PathBuf, homedir: String) -> String { if slashes > 3 { let parts: Vec<&str> = path.split("/").collect(); let len = parts.len() - 1; - let mut fch: String; + let mut ch1: String; - for p in &parts[0..len] { - let part = p; + for part in &parts[0..len] { if part.to_string() != "" { // to avoid the 1st "/" - fch = part.chars().next().expect(p).to_string(); // 1st char of p - short_dir = short_dir.replace(part, &fch); + ch1 = part.chars().next().expect(part).to_string(); // 1st char of each part + short_dir = short_dir.replace(part, &ch1); } } } @@ -71,8 +67,8 @@ fn main() -> std::io::Result<()> { }*/ match var_os("SSH_TTY") { Some(_val) => { - ssh_char = "".truecolor(34,109,155); - ssh_char_space = " ".to_string(); + ssh_char = "".on_truecolor(0,150,180).truecolor(20,20,20); + ssh_char_space = " ";//.to_string(); }, None => { ssh_char = "".truecolor(34,109,155); @@ -85,6 +81,7 @@ fn main() -> std::io::Result<()> { get_shell_char(shell).truecolor(75,75,75), abrev_path(pwd,homedir).italic().truecolor(82,82,82), angle.truecolor(0, 255, 180), - ); + ); + Ok(()) } \ No newline at end of file