1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-17 15:52:47 +00:00
starship/src/configs/fossil_metrics.rs
Vegard Skui e867cda1eb
feat(fossil_metrics): add fossil_metrics module (#4874)
* feat(fossil_metrics): add fossil_metrics module

* Return early if not in a Fossil check-out

* Add more tests for fossil_metrics

* Move is in Fossil checkout check after module enabled check

* Update type for new toml version

* Update the config file schema

* Rework parsing of fossil diff output

* Fix Fossil check-out detection in subdirectories

* Use regex to only match expected fossil diff output

* Use shared ancestor scanning and fix detection on Windows

* Add note on minimum Fossil version
2023-09-02 09:19:04 +02:00

29 lines
742 B
Rust

use serde::{Deserialize, Serialize};
#[derive(Clone, Deserialize, Serialize)]
#[cfg_attr(
feature = "config-schema",
derive(schemars::JsonSchema),
schemars(deny_unknown_fields)
)]
#[serde(default)]
pub struct FossilMetricsConfig<'a> {
pub format: &'a str,
pub added_style: &'a str,
pub deleted_style: &'a str,
pub only_nonzero_diffs: bool,
pub disabled: bool,
}
impl<'a> Default for FossilMetricsConfig<'a> {
fn default() -> Self {
FossilMetricsConfig {
format: "([+$added]($added_style) )([-$deleted]($deleted_style) )",
added_style: "bold green",
deleted_style: "bold red",
only_nonzero_diffs: true,
disabled: true,
}
}
}