path
This commit is contained in:
parent
5a1fca980d
commit
a9a7dc13b8
13
src/indicators/path.rs
Normal file
13
src/indicators/path.rs
Normal 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)
|
||||||
|
}
|
@ -1,11 +1,14 @@
|
|||||||
mod indicators {
|
mod indicators {
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod git;
|
pub mod git;
|
||||||
|
pub mod path;
|
||||||
pub mod ssh;
|
pub mod ssh;
|
||||||
pub mod user;
|
pub mod user;
|
||||||
}
|
}
|
||||||
|
|
||||||
use crate::indicators::error;
|
use crate::indicators::error;
|
||||||
use crate::indicators::git;
|
use crate::indicators::git;
|
||||||
|
use crate::indicators::path;
|
||||||
use crate::indicators::ssh;
|
use crate::indicators::ssh;
|
||||||
use crate::indicators::user;
|
use crate::indicators::user;
|
||||||
|
|
||||||
@ -17,7 +20,11 @@ fn main() {
|
|||||||
let indicate_ssh: bool = true;
|
let indicate_ssh: bool = true;
|
||||||
let indicate_err: bool = true;
|
let indicate_err: bool = true;
|
||||||
let indicate_git_branch: bool = true;
|
let indicate_git_branch: bool = true;
|
||||||
|
let pwd: bool = true;
|
||||||
|
|
||||||
|
if pwd {
|
||||||
|
prompt += &path::pwd().to_string();
|
||||||
|
}
|
||||||
if indicate_ssh {
|
if indicate_ssh {
|
||||||
prompt += &ssh::indicator().to_string();
|
prompt += &ssh::indicator().to_string();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user