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