2023-01-12 03:25:36 +00:00
|
|
|
use indexmap::IndexMap;
|
2022-03-26 09:42:19 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2022-09-27 21:08:52 +00:00
|
|
|
use std::collections::HashMap;
|
2019-10-25 01:08:09 +00:00
|
|
|
|
2022-03-26 09:42:19 +00:00
|
|
|
#[derive(Clone, Serialize, Deserialize, Debug)]
|
2022-09-09 12:59:38 +00:00
|
|
|
#[cfg_attr(
|
|
|
|
feature = "config-schema",
|
|
|
|
derive(schemars::JsonSchema),
|
|
|
|
schemars(deny_unknown_fields)
|
|
|
|
)]
|
2022-03-26 09:42:19 +00:00
|
|
|
#[serde(default)]
|
2021-10-27 13:13:17 +00:00
|
|
|
pub struct StarshipRootConfig {
|
2022-04-01 15:14:05 +00:00
|
|
|
#[serde(rename = "$schema")]
|
|
|
|
schema: String,
|
2021-10-27 13:13:17 +00:00
|
|
|
pub format: String,
|
|
|
|
pub right_format: String,
|
2022-01-01 13:12:11 +00:00
|
|
|
pub continuation_prompt: String,
|
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,
|
2023-11-02 08:01:09 +00:00
|
|
|
pub follow_symlinks: bool,
|
2022-09-27 21:08:52 +00:00
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
|
|
pub palette: Option<String>,
|
|
|
|
pub palettes: HashMap<String, Palette>,
|
2023-01-12 03:25:36 +00:00
|
|
|
pub profiles: IndexMap<String, String>,
|
2019-10-25 01:08:09 +00:00
|
|
|
}
|
|
|
|
|
2022-09-27 21:08:52 +00:00
|
|
|
pub type Palette = HashMap<String, String>;
|
|
|
|
|
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",
|
2022-01-30 20:31:26 +00:00
|
|
|
"localip",
|
2020-08-05 16:30:01 +00:00
|
|
|
"shlvl",
|
2020-07-07 22:45:32 +00:00
|
|
|
"singularity",
|
|
|
|
"kubernetes",
|
|
|
|
"directory",
|
2021-03-28 15:48:15 +00:00
|
|
|
"vcsh",
|
2023-01-31 08:06:46 +00:00
|
|
|
"fossil_branch",
|
2023-09-02 07:19:04 +00:00
|
|
|
"fossil_metrics",
|
2020-07-07 22:45:32 +00:00
|
|
|
"git_branch",
|
|
|
|
"git_commit",
|
|
|
|
"git_state",
|
2021-07-10 20:54:34 +00:00
|
|
|
"git_metrics",
|
2020-07-07 22:45:32 +00:00
|
|
|
"git_status",
|
|
|
|
"hg_branch",
|
2022-12-31 14:55:23 +00:00
|
|
|
"pijul_channel",
|
2020-07-07 22:45:32 +00:00
|
|
|
"docker_context",
|
|
|
|
"package",
|
|
|
|
// ↓ Toolchain version modules ↓
|
|
|
|
// (Let's keep these sorted alphabetically)
|
2022-08-01 10:59:36 +00:00
|
|
|
"bun",
|
2022-03-25 04:10:19 +00:00
|
|
|
"c",
|
2020-07-09 19:40:33 +00:00
|
|
|
"cmake",
|
2021-09-07 14:59:14 +00:00
|
|
|
"cobol",
|
2022-05-26 14:42:31 +00:00
|
|
|
"daml",
|
2020-07-29 15:38:23 +00:00
|
|
|
"dart",
|
2021-04-15 13:22:12 +00:00
|
|
|
"deno",
|
2020-07-07 22:45:32 +00:00
|
|
|
"dotnet",
|
|
|
|
"elixir",
|
|
|
|
"elm",
|
|
|
|
"erlang",
|
2022-12-21 16:53:53 +00:00
|
|
|
"fennel",
|
2020-07-07 22:45:32 +00:00
|
|
|
"golang",
|
2022-12-17 12:32:40 +00:00
|
|
|
"gradle",
|
2022-03-18 06:45:51 +00:00
|
|
|
"haskell",
|
2022-12-04 17:28:49 +00:00
|
|
|
"haxe",
|
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",
|
2022-10-15 16:15:33 +00:00
|
|
|
"opa",
|
2020-08-04 16:22:44 +00:00
|
|
|
"perl",
|
2020-07-07 22:45:32 +00:00
|
|
|
"php",
|
2021-10-05 23:27:25 +00:00
|
|
|
"pulumi",
|
2020-07-07 22:45:32 +00:00
|
|
|
"purescript",
|
|
|
|
"python",
|
2022-06-26 10:00:55 +00:00
|
|
|
"raku",
|
2021-05-25 18:13:30 +00:00
|
|
|
"rlang",
|
2021-04-20 16:31:47 +00:00
|
|
|
"red",
|
2020-07-07 22:45:32 +00:00
|
|
|
"ruby",
|
|
|
|
"rust",
|
2021-03-14 19:37:00 +00:00
|
|
|
"scala",
|
2023-04-13 19:05:12 +00:00
|
|
|
"solidity",
|
2020-07-29 15:36:49 +00:00
|
|
|
"swift",
|
2020-07-07 22:45:32 +00:00
|
|
|
"terraform",
|
2021-05-03 19:50:29 +00:00
|
|
|
"vlang",
|
2021-01-30 11:05:16 +00:00
|
|
|
"vagrant",
|
2020-07-07 22:45:32 +00:00
|
|
|
"zig",
|
|
|
|
// ↑ Toolchain version modules ↑
|
2022-03-12 11:10:23 +00:00
|
|
|
"buf",
|
2022-10-25 05:44:04 +00:00
|
|
|
"guix_shell",
|
2020-07-07 22:45:32 +00:00
|
|
|
"nix_shell",
|
|
|
|
"conda",
|
2022-10-11 16:02:46 +00:00
|
|
|
"meson",
|
2022-04-03 13:33:14 +00:00
|
|
|
"spack",
|
2020-07-07 22:45:32 +00:00
|
|
|
"memory_usage",
|
|
|
|
"aws",
|
2020-08-03 21:30:20 +00:00
|
|
|
"gcloud",
|
2020-10-24 09:46:43 +00:00
|
|
|
"openstack",
|
2021-12-06 22:01:33 +00:00
|
|
|
"azure",
|
2020-07-07 22:45:32 +00:00
|
|
|
"env_var",
|
|
|
|
"crystal",
|
|
|
|
"custom",
|
2021-11-15 05:46:13 +00:00
|
|
|
"sudo",
|
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",
|
2022-01-21 15:44:46 +00:00
|
|
|
"container",
|
2022-11-06 21:37:58 +00:00
|
|
|
"os",
|
2021-02-20 14:40:49 +00:00
|
|
|
"shell",
|
2020-07-07 22:45:32 +00:00
|
|
|
"character",
|
|
|
|
];
|
|
|
|
|
2021-04-26 17:55:22 +00:00
|
|
|
// On changes please also update `Default` for the `FullConfig` struct in `mod.rs`
|
2022-06-30 20:18:29 +00:00
|
|
|
impl Default for StarshipRootConfig {
|
2021-03-15 10:40:52 +00:00
|
|
|
fn default() -> Self {
|
2022-05-23 10:58:27 +00:00
|
|
|
Self {
|
2022-04-01 15:14:05 +00:00
|
|
|
schema: "https://starship.rs/config-schema.json".to_string(),
|
2021-10-27 13:13:17 +00:00
|
|
|
format: "$all".to_string(),
|
2022-11-05 11:40:46 +00:00
|
|
|
right_format: String::new(),
|
2022-01-01 19:39:08 +00:00
|
|
|
continuation_prompt: "[∙](bright-black) ".to_string(),
|
2023-01-12 03:25:36 +00:00
|
|
|
profiles: Default::default(),
|
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,
|
2023-11-02 08:01:09 +00:00
|
|
|
follow_symlinks: true,
|
2022-09-27 21:08:52 +00:00
|
|
|
palette: None,
|
|
|
|
palettes: HashMap::default(),
|
2019-10-25 01:08:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|