2021-03-15 10:40:52 +00:00
|
|
|
use crate::config::{ModuleConfig, VecOr};
|
2020-04-11 16:37:24 +00:00
|
|
|
|
2021-03-31 15:31:55 +00:00
|
|
|
use serde::{self, Serialize};
|
2020-04-11 16:37:24 +00:00
|
|
|
use starship_module_config_derive::ModuleConfig;
|
|
|
|
|
2021-03-31 15:31:55 +00:00
|
|
|
#[derive(Clone, ModuleConfig, Serialize)]
|
2020-04-11 16:37:24 +00:00
|
|
|
pub struct CustomConfig<'a> {
|
2020-07-07 22:45:32 +00:00
|
|
|
pub format: &'a str,
|
|
|
|
pub symbol: &'a str,
|
2020-04-11 16:37:24 +00:00
|
|
|
pub command: &'a str,
|
2021-03-31 15:31:55 +00:00
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
2020-04-11 16:37:24 +00:00
|
|
|
pub when: Option<&'a str>,
|
2020-05-27 07:38:05 +00:00
|
|
|
pub shell: VecOr<&'a str>,
|
2020-04-11 16:37:24 +00:00
|
|
|
pub description: &'a str,
|
2020-07-07 22:45:32 +00:00
|
|
|
pub style: &'a str,
|
2020-04-11 16:37:24 +00:00
|
|
|
pub disabled: bool,
|
2021-03-31 15:31:55 +00:00
|
|
|
pub files: Vec<&'a str>,
|
|
|
|
pub extensions: Vec<&'a str>,
|
|
|
|
pub directories: Vec<&'a str>,
|
2021-06-13 06:23:46 +00:00
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
|
|
pub os: Option<&'a str>,
|
2020-04-11 16:37:24 +00:00
|
|
|
}
|
|
|
|
|
2021-03-15 10:40:52 +00:00
|
|
|
impl<'a> Default for CustomConfig<'a> {
|
|
|
|
fn default() -> Self {
|
2020-04-11 16:37:24 +00:00
|
|
|
CustomConfig {
|
2021-01-20 18:01:49 +00:00
|
|
|
format: "[$symbol($output )]($style)",
|
2020-07-07 22:45:32 +00:00
|
|
|
symbol: "",
|
2020-04-11 16:37:24 +00:00
|
|
|
command: "",
|
|
|
|
when: None,
|
2020-05-27 07:38:05 +00:00
|
|
|
shell: VecOr::default(),
|
2020-04-11 16:37:24 +00:00
|
|
|
description: "<custom config>",
|
2020-07-07 22:45:32 +00:00
|
|
|
style: "green bold",
|
2020-04-11 16:37:24 +00:00
|
|
|
disabled: false,
|
2021-03-31 15:31:55 +00:00
|
|
|
files: Vec::default(),
|
|
|
|
extensions: Vec::default(),
|
|
|
|
directories: Vec::default(),
|
2021-06-13 06:23:46 +00:00
|
|
|
os: None,
|
2020-04-11 16:37:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|