2022-03-26 09:42:19 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2019-10-15 11:48:53 +00:00
|
|
|
|
2022-03-26 09:42:19 +00:00
|
|
|
#[derive(Clone, Deserialize, Serialize)]
|
2022-09-09 12:59:38 +00:00
|
|
|
#[cfg_attr(
|
|
|
|
feature = "config-schema",
|
|
|
|
derive(schemars::JsonSchema),
|
|
|
|
schemars(deny_unknown_fields)
|
|
|
|
)]
|
2022-03-26 09:42:19 +00:00
|
|
|
#[serde(default)]
|
2019-10-15 11:48:53 +00:00
|
|
|
pub struct GitBranchConfig<'a> {
|
2020-07-07 22:45:32 +00:00
|
|
|
pub format: &'a str,
|
|
|
|
pub symbol: &'a str,
|
|
|
|
pub style: &'a str,
|
2019-10-15 11:48:53 +00:00
|
|
|
pub truncation_length: i64,
|
|
|
|
pub truncation_symbol: &'a str,
|
2020-11-23 18:22:51 +00:00
|
|
|
pub only_attached: bool,
|
2020-11-23 21:07:16 +00:00
|
|
|
pub always_show_remote: bool,
|
2022-03-16 20:41:49 +00:00
|
|
|
pub ignore_branches: Vec<&'a str>,
|
2019-10-15 11:48:53 +00:00
|
|
|
pub disabled: bool,
|
|
|
|
}
|
|
|
|
|
2021-03-15 10:40:52 +00:00
|
|
|
impl<'a> Default for GitBranchConfig<'a> {
|
|
|
|
fn default() -> Self {
|
2019-10-15 11:48:53 +00:00
|
|
|
GitBranchConfig {
|
2022-04-26 18:02:01 +00:00
|
|
|
format: "on [$symbol$branch(:$remote_branch)]($style) ",
|
2020-07-07 22:45:32 +00:00
|
|
|
symbol: " ",
|
|
|
|
style: "bold purple",
|
2019-10-15 11:48:53 +00:00
|
|
|
truncation_length: std::i64::MAX,
|
|
|
|
truncation_symbol: "…",
|
2020-11-23 18:22:51 +00:00
|
|
|
only_attached: false,
|
2020-11-23 21:07:16 +00:00
|
|
|
always_show_remote: false,
|
2022-03-16 20:41:49 +00:00
|
|
|
ignore_branches: vec![],
|
2019-10-15 11:48:53 +00:00
|
|
|
disabled: false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|