1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-16 18:15:16 +00:00
starship/src/configs/custom.rs

42 lines
1.1 KiB
Rust
Raw Normal View History

use crate::config::{ModuleConfig, VecOr};
2020-04-11 16:37:24 +00:00
use serde::{self, Serialize};
2020-04-11 16:37:24 +00:00
use starship_module_config_derive::ModuleConfig;
#[derive(Clone, ModuleConfig, Serialize)]
2020-04-11 16:37:24 +00:00
pub struct CustomConfig<'a> {
pub format: &'a str,
pub symbol: &'a str,
2020-04-11 16:37:24 +00:00
pub command: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
2020-04-11 16:37:24 +00:00
pub when: Option<&'a str>,
pub shell: VecOr<&'a str>,
2020-04-11 16:37:24 +00:00
pub description: &'a str,
pub style: &'a str,
2020-04-11 16:37:24 +00:00
pub disabled: bool,
pub files: Vec<&'a str>,
pub extensions: Vec<&'a str>,
pub directories: Vec<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
pub os: Option<&'a str>,
2020-04-11 16:37:24 +00:00
}
impl<'a> Default for CustomConfig<'a> {
fn default() -> Self {
2020-04-11 16:37:24 +00:00
CustomConfig {
format: "[$symbol($output )]($style)",
symbol: "",
2020-04-11 16:37:24 +00:00
command: "",
when: None,
shell: VecOr::default(),
2020-04-11 16:37:24 +00:00
description: "<custom config>",
style: "green bold",
2020-04-11 16:37:24 +00:00
disabled: false,
files: Vec::default(),
extensions: Vec::default(),
directories: Vec::default(),
os: None,
2020-04-11 16:37:24 +00:00
}
}
}