This commit is contained in:
Candifloss 2024-11-26 12:34:31 +05:30
parent 5a1fca980d
commit a9a7dc13b8
2 changed files with 20 additions and 0 deletions

13
src/indicators/path.rs Normal file
View File

@ -0,0 +1,13 @@
use ansi_term::ANSIGenericString;
use ansi_term::Colour::RGB;
use std::env::current_dir;
pub const PATH_COL: ansi_term::Colour = RGB(82, 82, 82); //
pub fn pwd() -> ANSIGenericString<'static, str> {
let path = current_dir().map_or_else(
|_| "~~".to_string(),
|path| path.to_string_lossy().to_string(),
);
PATH_COL.italic().paint(path)
}

View File

@ -1,11 +1,14 @@
mod indicators {
pub mod error;
pub mod git;
pub mod path;
pub mod ssh;
pub mod user;
}
use crate::indicators::error;
use crate::indicators::git;
use crate::indicators::path;
use crate::indicators::ssh;
use crate::indicators::user;
@ -17,7 +20,11 @@ fn main() {
let indicate_ssh: bool = true;
let indicate_err: bool = true;
let indicate_git_branch: bool = true;
let pwd: bool = true;
if pwd {
prompt += &path::pwd().to_string();
}
if indicate_ssh {
prompt += &ssh::indicator().to_string();
}