mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-06-07 02:50:47 +00:00
3109943822
* docs(os): Add os module documentation * docs(os): Add os to Default Prompt Format * chore(os): Update config file schema * feat(os): Add os entries and declarations * feat(os): Add os module and config * fix(os): Obey config.disabled * feat(os): make variables 'Unknown'-aware refactor(os): calculate variables in dedicated functions * test(os): Add os module tests * feat(os): make 'name' variable less 'Unknown'-aware * docs(os): Add Preset configurations docs(os): Use emoji as default * feat(os): Use emoji as default test(os): Use emoji as default * fix(os): Add spaces after emoji symbols * chore(os): Update config schema * feat(os): Remove `bitness` variable docs(os): Remove `bitness` variable test(os): Remove `bitness` test * feat(os): Add Cargo.toml upgrade caution for os_info * refactor(os): Clarify get_symbol function * docs(os): Mention supported operating systems and feature requests * docs(os): Mention os_info inacurracy * test(os): Remove `bitness` leftovers * refactor(os): use nu_ansi_term * refactor(os): add cfg_attr(schemars(deny_unknown_fields)) * chore(os): update config schema * docs(os): expose details block * feat(os): add garuda linux * chore(os): update config schema * feat(os): add case insensitivity * feat(os): add symbols `IndexMap` use `os_info::Type` instead of `String` * test(os): add clippy warn on new os_info::Type case * leave missing case to test github tests * test(os): re-add missing test case * style(os): fix formatting * docs(os): update to match os_info::Type serialization - docs(os): add missing garuda to config - test(os): mention docs updates in warn_on_os_info_update
132 lines
2.7 KiB
Rust
132 lines
2.7 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
use std::collections::HashMap;
|
|
|
|
#[derive(Clone, Serialize, Deserialize, Debug)]
|
|
#[cfg_attr(
|
|
feature = "config-schema",
|
|
derive(schemars::JsonSchema),
|
|
schemars(deny_unknown_fields)
|
|
)]
|
|
#[serde(default)]
|
|
pub struct StarshipRootConfig {
|
|
#[serde(rename = "$schema")]
|
|
schema: String,
|
|
pub format: String,
|
|
pub right_format: String,
|
|
pub continuation_prompt: String,
|
|
pub scan_timeout: u64,
|
|
pub command_timeout: u64,
|
|
pub add_newline: bool,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub palette: Option<String>,
|
|
pub palettes: HashMap<String, Palette>,
|
|
}
|
|
|
|
pub type Palette = HashMap<String, String>;
|
|
|
|
// 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.
|
|
pub const PROMPT_ORDER: &[&str] = &[
|
|
"username",
|
|
"hostname",
|
|
"localip",
|
|
"shlvl",
|
|
"singularity",
|
|
"kubernetes",
|
|
"directory",
|
|
"vcsh",
|
|
"git_branch",
|
|
"git_commit",
|
|
"git_state",
|
|
"git_metrics",
|
|
"git_status",
|
|
"hg_branch",
|
|
"docker_context",
|
|
"package",
|
|
// ↓ Toolchain version modules ↓
|
|
// (Let's keep these sorted alphabetically)
|
|
"bun",
|
|
"c",
|
|
"cmake",
|
|
"cobol",
|
|
"daml",
|
|
"dart",
|
|
"deno",
|
|
"dotnet",
|
|
"elixir",
|
|
"elm",
|
|
"erlang",
|
|
"golang",
|
|
"haskell",
|
|
"helm",
|
|
"java",
|
|
"julia",
|
|
"kotlin",
|
|
"lua",
|
|
"nim",
|
|
"nodejs",
|
|
"ocaml",
|
|
"opa",
|
|
"perl",
|
|
"php",
|
|
"pulumi",
|
|
"purescript",
|
|
"python",
|
|
"raku",
|
|
"rlang",
|
|
"red",
|
|
"ruby",
|
|
"rust",
|
|
"scala",
|
|
"swift",
|
|
"terraform",
|
|
"vlang",
|
|
"vagrant",
|
|
"zig",
|
|
// ↑ Toolchain version modules ↑
|
|
"buf",
|
|
"guix_shell",
|
|
"nix_shell",
|
|
"conda",
|
|
"meson",
|
|
"spack",
|
|
"memory_usage",
|
|
"aws",
|
|
"gcloud",
|
|
"openstack",
|
|
"azure",
|
|
"env_var",
|
|
"crystal",
|
|
"custom",
|
|
"sudo",
|
|
"cmd_duration",
|
|
"line_break",
|
|
"jobs",
|
|
#[cfg(feature = "battery")]
|
|
"battery",
|
|
"time",
|
|
"status",
|
|
"container",
|
|
"os",
|
|
"shell",
|
|
"character",
|
|
];
|
|
|
|
// On changes please also update `Default` for the `FullConfig` struct in `mod.rs`
|
|
impl Default for StarshipRootConfig {
|
|
fn default() -> Self {
|
|
Self {
|
|
schema: "https://starship.rs/config-schema.json".to_string(),
|
|
format: "$all".to_string(),
|
|
right_format: String::new(),
|
|
continuation_prompt: "[∙](bright-black) ".to_string(),
|
|
scan_timeout: 30,
|
|
command_timeout: 500,
|
|
add_newline: true,
|
|
palette: None,
|
|
palettes: HashMap::default(),
|
|
}
|
|
}
|
|
}
|