1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-20 11:55:11 +00:00
starship/src/print.rs

31 lines
545 B
Rust
Raw Normal View History

2019-04-04 00:14:26 +00:00
use crate::modules;
use crate::Segment;
pub fn prompt() {
let default_prompt = vec!["char"];
for module in default_prompt {
let segment = modules::handle(module);
print_segment(segment);
}
}
fn print_segment(segment: Segment) {
let Segment {
prefix,
value,
style,
suffix,
} = segment;
if let Some(prefix) = prefix {
print_segment(*prefix);
}
print!("{}", style.paint(value));
if let Some(suffix) = suffix {
print_segment(*suffix);
}
}