1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-16 10:05:13 +00:00
starship/src/modules/mod.rs

72 lines
2.2 KiB
Rust
Raw Normal View History

// While adding out new module add out module to src/module.rs ALL_MODULES const array also.
mod aws;
2019-04-05 01:35:24 +00:00
mod character;
mod cmd_duration;
2019-10-05 18:25:25 +00:00
mod conda;
2019-04-05 00:35:35 +00:00
mod directory;
mod dotnet;
mod env_var;
mod git_branch;
mod git_state;
2019-05-14 04:43:11 +00:00
mod git_status;
mod golang;
mod hostname;
mod java;
mod jobs;
mod kubernetes;
2019-04-05 00:35:35 +00:00
mod line_break;
mod memory_usage;
2019-08-25 15:41:20 +00:00
mod nix_shell;
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-08-13 22:43:29 +00:00
mod ruby;
2019-04-21 23:37:34 +00:00
mod rust;
mod time;
mod username;
2019-04-04 00:14:26 +00:00
#[cfg(feature = "battery")]
mod battery;
use crate::config::RootModuleConfig;
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 {
// Keep these ordered alphabetically.
// Default ordering is handled in configs/mod.rs
"aws" => aws::module(context),
#[cfg(feature = "battery")]
"battery" => battery::module(context),
"character" => character::module(context),
"cmd_duration" => cmd_duration::module(context),
2019-10-05 18:25:25 +00:00
"conda" => conda::module(context),
"directory" => directory::module(context),
"dotnet" => dotnet::module(context),
"env_var" => env_var::module(context),
"git_branch" => git_branch::module(context),
"git_state" => git_state::module(context),
"git_status" => git_status::module(context),
"golang" => golang::module(context),
"hostname" => hostname::module(context),
"java" => java::module(context),
"jobs" => jobs::module(context),
"kubernetes" => kubernetes::module(context),
"line_break" => line_break::module(context),
"memory_usage" => memory_usage::module(context),
2019-08-25 15:41:20 +00:00
"nix_shell" => nix_shell::module(context),
"nodejs" => nodejs::module(context),
"package" => package::module(context),
"python" => python::module(context),
"ruby" => ruby::module(context),
"rust" => rust::module(context),
"time" => time::module(context),
"username" => username::module(context),
_ => {
eprintln!("Error: Unknown module {}. Use starship module --list to list out all supported modules.", module);
None
}
2019-04-04 00:14:26 +00:00
}
}