starship/src/modules/mod.rs

31 lines
599 B
Rust
Raw Normal View History

2019-04-04 02:14:26 +02:00
mod char;
2019-04-04 04:57:50 +02:00
use clap::ArgMatches;
2019-04-04 18:18:02 +02:00
use ansi_term::Style;
pub struct Segment {
pub style: Style,
pub value: String,
pub prefix: Option<Box<Segment>>,
pub suffix: Option<Box<Segment>>,
}
impl Default for Segment {
fn default() -> Segment {
Segment {
style: Style::default(),
value: String::from(""),
prefix: None,
suffix: None
}
}
}
2019-04-04 02:14:26 +02:00
2019-04-04 04:57:50 +02:00
pub fn handle(module: &str, args: &ArgMatches) -> Segment {
2019-04-04 02:14:26 +02:00
match module {
2019-04-04 04:57:50 +02:00
"char" => char::segment(&args),
2019-04-04 02:14:26 +02:00
_ => panic!("Unknown module: {}", module),
}
}