2019-10-25 01:08:09 +00:00
|
|
|
use crate::config::{ModuleConfig, RootModuleConfig};
|
|
|
|
|
|
|
|
use starship_module_config_derive::ModuleConfig;
|
|
|
|
|
|
|
|
#[derive(Clone, ModuleConfig)]
|
|
|
|
pub struct StarshipRootConfig<'a> {
|
2020-07-07 22:45:32 +00:00
|
|
|
pub format: &'a str,
|
2019-10-28 13:41:16 +00:00
|
|
|
pub scan_timeout: u64,
|
2021-02-11 20:34:47 +00:00
|
|
|
pub command_timeout: u64,
|
2020-08-18 16:58:29 +00:00
|
|
|
pub add_newline: bool,
|
2019-10-25 01:08:09 +00:00
|
|
|
}
|
|
|
|
|
2020-07-07 22:45:32 +00:00
|
|
|
// List of default prompt order
|
|
|
|
// NOTE: If this const value is changed then Default prompt order subheading inside
|
|
|
|
// prompt heading of config docs needs to be updated according to changes made here.
|
2020-07-24 21:42:36 +00:00
|
|
|
pub const PROMPT_ORDER: &[&str] = &[
|
2020-07-07 22:45:32 +00:00
|
|
|
"username",
|
|
|
|
"hostname",
|
2020-08-05 16:30:01 +00:00
|
|
|
"shlvl",
|
2020-07-07 22:45:32 +00:00
|
|
|
"singularity",
|
|
|
|
"kubernetes",
|
|
|
|
"directory",
|
|
|
|
"git_branch",
|
|
|
|
"git_commit",
|
|
|
|
"git_state",
|
|
|
|
"git_status",
|
|
|
|
"hg_branch",
|
|
|
|
"docker_context",
|
|
|
|
"package",
|
|
|
|
// ↓ Toolchain version modules ↓
|
|
|
|
// (Let's keep these sorted alphabetically)
|
2020-07-09 19:40:33 +00:00
|
|
|
"cmake",
|
2020-07-29 15:38:23 +00:00
|
|
|
"dart",
|
2020-07-07 22:45:32 +00:00
|
|
|
"dotnet",
|
|
|
|
"elixir",
|
|
|
|
"elm",
|
|
|
|
"erlang",
|
|
|
|
"golang",
|
2020-07-17 07:51:25 +00:00
|
|
|
"helm",
|
2020-07-07 22:45:32 +00:00
|
|
|
"java",
|
|
|
|
"julia",
|
2020-12-26 14:26:50 +00:00
|
|
|
"kotlin",
|
2020-10-27 18:05:20 +00:00
|
|
|
"lua",
|
2020-07-07 22:45:32 +00:00
|
|
|
"nim",
|
|
|
|
"nodejs",
|
|
|
|
"ocaml",
|
2020-08-04 16:22:44 +00:00
|
|
|
"perl",
|
2020-07-07 22:45:32 +00:00
|
|
|
"php",
|
|
|
|
"purescript",
|
|
|
|
"python",
|
|
|
|
"ruby",
|
|
|
|
"rust",
|
2020-07-29 15:36:49 +00:00
|
|
|
"swift",
|
2020-07-07 22:45:32 +00:00
|
|
|
"terraform",
|
2021-01-30 11:05:16 +00:00
|
|
|
"vagrant",
|
2020-07-07 22:45:32 +00:00
|
|
|
"zig",
|
|
|
|
// ↑ Toolchain version modules ↑
|
|
|
|
"nix_shell",
|
|
|
|
"conda",
|
|
|
|
"memory_usage",
|
|
|
|
"aws",
|
2020-08-03 21:30:20 +00:00
|
|
|
"gcloud",
|
2020-10-24 09:46:43 +00:00
|
|
|
"openstack",
|
2020-07-07 22:45:32 +00:00
|
|
|
"env_var",
|
|
|
|
"crystal",
|
|
|
|
"custom",
|
2020-12-05 18:57:22 +00:00
|
|
|
"cmd_duration",
|
2020-07-07 22:45:32 +00:00
|
|
|
"line_break",
|
|
|
|
"jobs",
|
|
|
|
#[cfg(feature = "battery")]
|
|
|
|
"battery",
|
|
|
|
"time",
|
2020-09-25 22:04:51 +00:00
|
|
|
"status",
|
2021-02-20 14:40:49 +00:00
|
|
|
"shell",
|
2020-07-07 22:45:32 +00:00
|
|
|
"character",
|
|
|
|
];
|
|
|
|
|
2019-10-25 01:08:09 +00:00
|
|
|
impl<'a> RootModuleConfig<'a> for StarshipRootConfig<'a> {
|
|
|
|
fn new() -> Self {
|
|
|
|
StarshipRootConfig {
|
2020-08-18 16:58:29 +00:00
|
|
|
format: "$all",
|
2019-10-28 13:41:16 +00:00
|
|
|
scan_timeout: 30,
|
2021-02-11 20:34:47 +00:00
|
|
|
command_timeout: 500,
|
2020-08-18 16:58:29 +00:00
|
|
|
add_newline: true,
|
2019-10-25 01:08:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|