1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-22 18:05:14 +00:00
starship/src/configs/time.rs
David Knaack d06ba072a8
feat(config): allow printing default and computed config (#2521)
* feat: allow printing default and computed config

* fix custom modules

* actually fix custom modules
2021-03-31 17:31:55 +02:00

31 lines
767 B
Rust

use crate::config::ModuleConfig;
use serde::Serialize;
use starship_module_config_derive::ModuleConfig;
#[derive(Clone, ModuleConfig, Serialize)]
pub struct TimeConfig<'a> {
pub format: &'a str,
pub style: &'a str,
pub use_12hr: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub time_format: Option<&'a str>,
pub disabled: bool,
pub utc_time_offset: &'a str,
pub time_range: &'a str,
}
impl<'a> Default for TimeConfig<'a> {
fn default() -> Self {
TimeConfig {
format: "at [$time]($style) ",
style: "bold yellow",
use_12hr: false,
time_format: None,
disabled: true,
utc_time_offset: "local",
time_range: "-",
}
}
}