2019-08-20 10:27:25 +05:45
|
|
|
// While adding out new module add out module to src/module.rs ALL_MODULES const array also.
|
2019-09-26 04:55:47 +02:00
|
|
|
mod aws;
|
2019-04-04 21:35:24 -04:00
|
|
|
mod character;
|
2019-08-08 10:25:30 -07:00
|
|
|
mod cmd_duration;
|
2019-10-05 20:25:25 +02:00
|
|
|
mod conda;
|
2019-04-04 20:35:35 -04:00
|
|
|
mod directory;
|
2019-10-02 16:56:49 +10:00
|
|
|
mod dotnet;
|
2019-09-26 10:30:58 +02:00
|
|
|
mod env_var;
|
2019-04-26 22:07:07 -04:00
|
|
|
mod git_branch;
|
2019-09-06 02:45:04 +10:00
|
|
|
mod git_state;
|
2019-05-13 22:43:11 -06:00
|
|
|
mod git_status;
|
2019-07-19 16:18:52 -04:00
|
|
|
mod golang;
|
2019-12-02 23:37:18 +01:00
|
|
|
mod hg_branch;
|
2019-09-04 10:03:31 -07:00
|
|
|
mod hostname;
|
2019-09-20 01:02:53 +02:00
|
|
|
mod java;
|
2019-08-12 18:42:33 +01:00
|
|
|
mod jobs;
|
2019-10-01 20:58:24 +02:00
|
|
|
mod kubernetes;
|
2019-04-04 20:35:35 -04:00
|
|
|
mod line_break;
|
2019-09-28 22:55:49 -07:00
|
|
|
mod memory_usage;
|
2019-08-25 11:41:20 -04:00
|
|
|
mod nix_shell;
|
2019-04-10 09:22:11 -04:00
|
|
|
mod nodejs;
|
2019-05-01 15:45:56 +01:00
|
|
|
mod package;
|
2019-04-25 16:06:18 +01:00
|
|
|
mod python;
|
2019-08-13 19:43:29 -03:00
|
|
|
mod ruby;
|
2019-04-21 19:37:34 -04:00
|
|
|
mod rust;
|
2019-09-10 18:54:40 +01:00
|
|
|
mod time;
|
2019-05-20 02:26:12 +00:00
|
|
|
mod username;
|
2019-10-25 03:00:05 +02:00
|
|
|
mod utils;
|
2019-04-03 20:14:26 -04:00
|
|
|
|
2019-08-26 14:09:39 -04:00
|
|
|
#[cfg(feature = "battery")]
|
|
|
|
|
mod battery;
|
|
|
|
|
|
2019-10-19 09:51:38 +08:00
|
|
|
use crate::config::{RootModuleConfig, SegmentConfig};
|
2019-04-19 16:57:14 -04:00
|
|
|
use crate::context::Context;
|
2019-05-01 16:34:24 -04:00
|
|
|
use crate::module::Module;
|
2019-04-04 12:18:02 -04:00
|
|
|
|
2019-06-10 15:56:17 +01:00
|
|
|
pub fn handle<'a>(module: &str, context: &'a Context) -> Option<Module<'a>> {
|
2019-04-03 20:14:26 -04:00
|
|
|
match module {
|
2019-10-02 16:56:49 +10:00
|
|
|
// Keep these ordered alphabetically.
|
|
|
|
|
// Default ordering is handled in configs/mod.rs
|
2019-09-26 04:55:47 +02:00
|
|
|
"aws" => aws::module(context),
|
2019-10-02 16:56:49 +10:00
|
|
|
#[cfg(feature = "battery")]
|
|
|
|
|
"battery" => battery::module(context),
|
2019-08-13 12:30:59 -04:00
|
|
|
"character" => character::module(context),
|
2019-10-02 16:56:49 +10:00
|
|
|
"cmd_duration" => cmd_duration::module(context),
|
2019-10-05 20:25:25 +02:00
|
|
|
"conda" => conda::module(context),
|
|
|
|
|
"directory" => directory::module(context),
|
2019-10-02 16:56:49 +10:00
|
|
|
"dotnet" => dotnet::module(context),
|
|
|
|
|
"env_var" => env_var::module(context),
|
2019-07-02 16:12:53 -04:00
|
|
|
"git_branch" => git_branch::module(context),
|
2019-09-06 02:45:04 +10:00
|
|
|
"git_state" => git_state::module(context),
|
2019-07-02 16:12:53 -04:00
|
|
|
"git_status" => git_status::module(context),
|
2019-10-02 16:56:49 +10:00
|
|
|
"golang" => golang::module(context),
|
2019-12-02 23:37:18 +01:00
|
|
|
"hg_branch" => hg_branch::module(context),
|
2019-10-02 16:56:49 +10:00
|
|
|
"hostname" => hostname::module(context),
|
2019-09-20 01:02:53 +02:00
|
|
|
"java" => java::module(context),
|
2019-08-12 18:42:33 +01:00
|
|
|
"jobs" => jobs::module(context),
|
2019-10-02 16:56:49 +10:00
|
|
|
"kubernetes" => kubernetes::module(context),
|
|
|
|
|
"line_break" => line_break::module(context),
|
|
|
|
|
"memory_usage" => memory_usage::module(context),
|
2019-08-25 11:41:20 -04:00
|
|
|
"nix_shell" => nix_shell::module(context),
|
2019-10-02 16:56:49 +10:00
|
|
|
"nodejs" => nodejs::module(context),
|
|
|
|
|
"package" => package::module(context),
|
|
|
|
|
"python" => python::module(context),
|
|
|
|
|
"ruby" => ruby::module(context),
|
|
|
|
|
"rust" => rust::module(context),
|
2019-09-10 18:54:40 +01:00
|
|
|
"time" => time::module(context),
|
2019-10-02 16:56:49 +10:00
|
|
|
"username" => username::module(context),
|
2019-08-20 10:27:25 +05:45
|
|
|
_ => {
|
|
|
|
|
eprintln!("Error: Unknown module {}. Use starship module --list to list out all supported modules.", module);
|
|
|
|
|
None
|
|
|
|
|
}
|
2019-04-03 20:14:26 -04:00
|
|
|
}
|
|
|
|
|
}
|