mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
lib/omb-prompt-base: Check "oh-my-{bash,zsh}.hide-status" for git status
This commit is contained in:
@@ -108,6 +108,11 @@ function _omb_prompt_git {
|
|||||||
command git "$@"
|
command git "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _omb_prompt_git_status_enabled {
|
||||||
|
[[ $(_omb_prompt_git config --get-regexp '^(oh-my-zsh|bash-it|oh-my-bash)\.hide-status$' |
|
||||||
|
awk '$2== "1" {hide_status = 1;} END { print hide_status; }') != "1" ]]
|
||||||
|
}
|
||||||
|
|
||||||
function scm {
|
function scm {
|
||||||
if [[ "$SCM_CHECK" = false ]]; then SCM=$SCM_NONE
|
if [[ "$SCM_CHECK" = false ]]; then SCM=$SCM_NONE
|
||||||
elif [[ -f .git/HEAD ]]; then SCM=$SCM_GIT
|
elif [[ -f .git/HEAD ]]; then SCM=$SCM_GIT
|
||||||
@@ -186,7 +191,7 @@ function git_prompt_minimal_info {
|
|||||||
local git_status_flags=('--porcelain')
|
local git_status_flags=('--porcelain')
|
||||||
SCM_STATE=${SCM_THEME_PROMPT_CLEAN}
|
SCM_STATE=${SCM_THEME_PROMPT_CLEAN}
|
||||||
|
|
||||||
if [[ "$(_omb_prompt_git config --get bash-it.hide-status)" != "1" ]]; then
|
if _omb_prompt_git_status_enabled; then
|
||||||
# Get the branch reference
|
# Get the branch reference
|
||||||
ref=$(git_clean_branch) || \
|
ref=$(git_clean_branch) || \
|
||||||
ref=$(_omb_prompt_git rev-parse --short HEAD 2> /dev/null) || return 0
|
ref=$(_omb_prompt_git rev-parse --short HEAD 2> /dev/null) || return 0
|
||||||
|
Reference in New Issue
Block a user