PrettyPrompt/src/main.rs

33 lines
767 B
Rust
Raw Normal View History

2024-11-21 10:58:26 +00:00
mod indicators {
pub mod git;
pub mod ssh;
2024-11-21 10:58:26 +00:00
pub mod user;
2024-08-14 14:58:16 +00:00
}
use indicators::git;
use crate::indicators::ssh;
2024-11-23 11:20:15 +00:00
use crate::indicators::user;
2024-08-14 14:58:16 +00:00
fn main() {
2024-11-23 11:20:15 +00:00
let mut prompt: String = String::new();
let indicate_user: bool = true;
let indicate_ssh: bool = true;
let indicate_git_branch: bool = true;
if indicate_git_branch {
let git_info = git::info();
match git_info {
Some((_repo, branch)) => prompt += &git::indicator(Some(branch)).to_string(),
None => prompt += &git::indicator(None).to_string(),
};
}
if indicate_ssh {
prompt += &ssh::indicator().to_string();
}
2024-11-23 11:20:15 +00:00
if indicate_user {
prompt += &user::indicator().to_string();
}
print!("{prompt} ");
2024-08-19 13:24:12 +00:00
}