starship/src/modules/mod.rs

39 lines
1.1 KiB
Rust
Raw Normal View History

2019-05-22 16:29:39 +00:00
mod battery;
2019-04-05 01:35:24 +00:00
mod character;
mod cmd_duration;
2019-04-05 00:35:35 +00:00
mod directory;
mod git_branch;
2019-05-14 04:43:11 +00:00
mod git_status;
mod golang;
mod jobs;
2019-04-05 00:35:35 +00:00
mod line_break;
2019-04-10 13:22:11 +00:00
mod nodejs;
2019-05-01 14:45:56 +00:00
mod package;
2019-04-25 15:06:18 +00:00
mod python;
2019-04-21 23:37:34 +00:00
mod rust;
mod username;
2019-04-04 00:14:26 +00:00
use crate::context::Context;
2019-05-01 20:34:24 +00:00
use crate::module::Module;
2019-04-04 16:18:02 +00:00
pub fn handle<'a>(module: &str, context: &'a Context) -> Option<Module<'a>> {
2019-04-04 00:14:26 +00:00
match module {
"dir" | "directory" => directory::module(context),
"char" | "character" => character::module(context),
"node" | "nodejs" => nodejs::module(context),
"rust" | "rustlang" => rust::module(context),
"python" => python::module(context),
"go" | "golang" => golang::module(context),
"line_break" => line_break::module(context),
"package" => package::module(context),
"git_branch" => git_branch::module(context),
"git_status" => git_status::module(context),
"username" => username::module(context),
"battery" => battery::module(context),
"cmd_duration" => cmd_duration::module(context),
"jobs" => jobs::module(context),
2019-04-04 00:14:26 +00:00
_ => panic!("Unknown module: {}", module),
}
}