1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-15 09:44:22 +00:00
starship/src/configs/git_status.rs
arcnmx a95332485b
perf(git_status): tweak exec flags to omit unnecessary info (#3287)
* perf(git_status): tweak flags to omit extra info

`git status` can be prohibitively slow on some repos, so allow the
config to influence what flags are passed to git. For instance, if there
is no configured symbol for untracked files, tell git to omit them from
its output. This can easily result in a 2~10x speedup in many cases, but
requires the user to opt-in to hiding information from the prompt.

* docs(git_status): add ignore_submodules option
2021-12-30 15:12:53 -06:00

46 lines
1.1 KiB
Rust

use crate::config::ModuleConfig;
use serde::Serialize;
use starship_module_config_derive::ModuleConfig;
#[derive(Clone, ModuleConfig, Serialize)]
pub struct GitStatusConfig<'a> {
pub format: &'a str,
pub style: &'a str,
pub stashed: &'a str,
pub ahead: &'a str,
pub behind: &'a str,
pub up_to_date: &'a str,
pub diverged: &'a str,
pub conflicted: &'a str,
pub deleted: &'a str,
pub renamed: &'a str,
pub modified: &'a str,
pub staged: &'a str,
pub untracked: &'a str,
pub ignore_submodules: bool,
pub disabled: bool,
}
impl<'a> Default for GitStatusConfig<'a> {
fn default() -> Self {
GitStatusConfig {
format: "([\\[$all_status$ahead_behind\\]]($style) )",
style: "red bold",
stashed: "\\$",
ahead: "",
behind: "",
up_to_date: "",
diverged: "",
conflicted: "=",
deleted: "",
renamed: "»",
modified: "!",
staged: "+",
untracked: "?",
ignore_submodules: false,
disabled: false,
}
}
}