1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-16 23:32:22 +00:00
starship/src/configs/status.rs
Hugues Morisset 40cb667b9d
feat(status): Add pipestatus display in status module (#2481)
* feat: Add pipestatus display in status module

This MR is based on this one https://github.com/starship/starship/pull/370

* Documentation

* Add a test with map_symbol false

* Handle bash preexec pipestatus

* Add zsh support

* Add fish support

Thanks kidonng for the diff patch

* Rename sucess_symbol to success_symbol
2021-07-28 12:26:00 -04:00

45 lines
1.3 KiB
Rust

use crate::config::ModuleConfig;
use serde::Serialize;
use starship_module_config_derive::ModuleConfig;
#[derive(Clone, ModuleConfig, Serialize)]
pub struct StatusConfig<'a> {
pub format: &'a str,
pub symbol: &'a str,
pub success_symbol: &'a str,
pub not_executable_symbol: &'a str,
pub not_found_symbol: &'a str,
pub sigint_symbol: &'a str,
pub signal_symbol: &'a str,
pub style: &'a str,
pub map_symbol: bool,
pub recognize_signal_code: bool,
pub pipestatus: bool,
pub pipestatus_separator: &'a str,
pub pipestatus_format: &'a str,
pub disabled: bool,
}
impl<'a> Default for StatusConfig<'a> {
fn default() -> Self {
StatusConfig {
format: "[$symbol$status]($style) ",
symbol: "",
success_symbol: "✔️",
not_executable_symbol: "🚫",
not_found_symbol: "🔍",
sigint_symbol: "🧱",
signal_symbol: "",
style: "bold red",
map_symbol: false,
recognize_signal_code: true,
pipestatus: false,
pipestatus_separator: "|",
pipestatus_format:
"\\[$pipestatus\\] => [$symbol$common_meaning$signal_name$maybe_int]($style)",
disabled: true,
}
}
}