mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-15 09:44:22 +00:00
fa3899719b
* #2750: Add Operating System condition to custom commands * update custom module config docs * fix os field name in custom module * Fix custom module false positives (when && os conditions) * Custom module operation system: check unix family * Custom module operation system: fix check unix family (use cfg!(unix)) * Update docs/config/README.md Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com> Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
42 lines
1.1 KiB
Rust
42 lines
1.1 KiB
Rust
use crate::config::{ModuleConfig, VecOr};
|
|
|
|
use serde::{self, Serialize};
|
|
use starship_module_config_derive::ModuleConfig;
|
|
|
|
#[derive(Clone, ModuleConfig, Serialize)]
|
|
pub struct CustomConfig<'a> {
|
|
pub format: &'a str,
|
|
pub symbol: &'a str,
|
|
pub command: &'a str,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub when: Option<&'a str>,
|
|
pub shell: VecOr<&'a str>,
|
|
pub description: &'a str,
|
|
pub style: &'a str,
|
|
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>,
|
|
}
|
|
|
|
impl<'a> Default for CustomConfig<'a> {
|
|
fn default() -> Self {
|
|
CustomConfig {
|
|
format: "[$symbol($output )]($style)",
|
|
symbol: "",
|
|
command: "",
|
|
when: None,
|
|
shell: VecOr::default(),
|
|
description: "<custom config>",
|
|
style: "green bold",
|
|
disabled: false,
|
|
files: Vec::default(),
|
|
extensions: Vec::default(),
|
|
directories: Vec::default(),
|
|
os: None,
|
|
}
|
|
}
|
|
}
|