1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-09-27 20:59:02 +00:00
starship/src/configs/kubernetes.rs
sk1985 e38be5073f
feat(kubernetes): context aliases (#1015)
* Allow kubernetes module to use aliases for contexts

* documentation for kubernetes context aliasing

* Apply suggestions from code review: consistent ordering of options in documentation

Co-Authored-By: Thomas O'Donnell <andytom@users.noreply.github.com>

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2020-04-03 20:18:44 +02:00

29 lines
836 B
Rust

use crate::config::{ModuleConfig, RootModuleConfig, SegmentConfig};
use ansi_term::{Color, Style};
use starship_module_config_derive::ModuleConfig;
use std::collections::HashMap;
#[derive(Clone, ModuleConfig)]
pub struct KubernetesConfig<'a> {
pub symbol: SegmentConfig<'a>,
pub context: SegmentConfig<'a>,
pub namespace: SegmentConfig<'a>,
pub style: Style,
pub disabled: bool,
pub context_aliases: HashMap<String, &'a str>,
}
impl<'a> RootModuleConfig<'a> for KubernetesConfig<'a> {
fn new() -> Self {
KubernetesConfig {
symbol: SegmentConfig::new(""),
context: SegmentConfig::default(),
namespace: SegmentConfig::default(),
style: Color::Cyan.bold(),
disabled: true,
context_aliases: HashMap::new(),
}
}
}