//use colored::{ColoredString, Colorize}; use colored::Colorize; use std::env::{args, current_dir, var_os}; mod indicators { pub mod error; pub mod git; pub mod path; pub mod shell; pub mod ssh; pub mod user; } use crate::indicators::{error::*, git::*, path::*, shell::*, ssh::*, user::*}; fn main() -> std::io::Result<()> { //let angle = "❯"; let args: Vec = args().collect(); let shell: String = shell(args.clone()); let root_indicator = root_indicator(); let err: String = err(args.clone()); let err_indicator = err_indicator(err); // SSH status let ssh_char = ssh_char(); //Git status let git_branch = get_git_branch(); let git_repo_root = get_git_root(); let git_repo_name = get_git_repo_name(&git_repo_root.clone()).truecolor(122, 68, 24); let git_char = get_git_char(&git_branch); //pwd let homedir = homedir(); let pwd = current_dir()?; let mut cur_dir = pwd.display().to_string(); cur_dir = cur_dir.replace(&git_repo_root, ""); // Remove git repo root cur_dir = cur_dir.replace(&homedir, "~"); // Abreviate homedir with "~" cur_dir = abrev_path(&cur_dir); print!( "{}{}{}{}{}{}{} ", ssh_char, get_shell_char(&shell).truecolor(75, 75, 75), git_repo_name, git_char, cur_dir.italic().truecolor(82, 82, 82), root_indicator, err_indicator, ); Ok(()) }