1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-25 13:30:07 +00:00

simpler ws handling in git

This commit is contained in:
romkatv 2019-03-19 23:47:19 +01:00
parent c04536ce70
commit db48e0d62f

View file

@ -1697,61 +1697,51 @@ function _p9k_vcs_render() {
local ws local ws
if [[ $POWERLEVEL9K_SHOW_CHANGESET == true || -z $VCS_STATUS_LOCAL_BRANCH ]]; then if [[ $POWERLEVEL9K_SHOW_CHANGESET == true || -z $VCS_STATUS_LOCAL_BRANCH ]]; then
_p9k_get_icon VCS_COMMIT_ICON _p9k_get_icon VCS_COMMIT_ICON
fmt COMMIT "$ws$_P9K_RETVAL${VCS_STATUS_COMMIT:0:$POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH}" fmt COMMIT "$_P9K_RETVAL${VCS_STATUS_COMMIT:0:$POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH}"
ws=' ' ws=' '
fi fi
if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
_p9k_get_icon VCS_BRANCH_ICON _p9k_get_icon VCS_BRANCH_ICON
fmt BRANCH "$ws$_P9K_RETVAL${VCS_STATUS_LOCAL_BRANCH//\%/%%}" fmt BRANCH "$ws$_P9K_RETVAL${VCS_STATUS_LOCAL_BRANCH//\%/%%}"
ws=' '
fi fi
if [[ $POWERLEVEL9K_VCS_HIDE_TAGS == false && -n $VCS_STATUS_TAG ]]; then if [[ $POWERLEVEL9K_VCS_HIDE_TAGS == false && -n $VCS_STATUS_TAG ]]; then
_p9k_get_icon VCS_TAG_ICON _p9k_get_icon VCS_TAG_ICON
fmt TAG "$ws$_P9K_RETVAL${VCS_STATUS_TAG//\%/%%}" fmt TAG " $_P9K_RETVAL${VCS_STATUS_TAG//\%/%%}"
ws=' '
fi fi
if [[ -n $VCS_STATUS_ACTION ]]; then if [[ -n $VCS_STATUS_ACTION ]]; then
fmt ACTION "$ws| ${VCS_STATUS_ACTION//\%/%%}" fmt ACTION " | ${VCS_STATUS_ACTION//\%/%%}"
ws=' '
else else
if [[ -n $VCS_STATUS_REMOTE_BRANCH && if [[ -n $VCS_STATUS_REMOTE_BRANCH &&
$VCS_STATUS_LOCAL_BRANCH != $VCS_STATUS_REMOTE_BRANCH ]]; then $VCS_STATUS_LOCAL_BRANCH != $VCS_STATUS_REMOTE_BRANCH ]]; then
_p9k_get_icon VCS_REMOTE_BRANCH_ICON _p9k_get_icon VCS_REMOTE_BRANCH_ICON
fmt REMOTE_BRANCH "$ws$_P9K_RETVAL${VCS_STATUS_REMOTE_BRANCH//\%/%%}" fmt REMOTE_BRANCH " $_P9K_RETVAL${VCS_STATUS_REMOTE_BRANCH//\%/%%}"
ws=' '
fi fi
if [[ $VCS_STATUS_HAS_STAGED == 1 ]]; then if [[ $VCS_STATUS_HAS_STAGED == 1 ]]; then
_p9k_get_icon VCS_STAGED_ICON _p9k_get_icon VCS_STAGED_ICON
fmt STAGED "$ws$_P9K_RETVAL" fmt STAGED " $_P9K_RETVAL"
ws=' '
fi fi
if [[ $VCS_STATUS_HAS_UNSTAGED == 1 ]]; then if [[ $VCS_STATUS_HAS_UNSTAGED == 1 ]]; then
_p9k_get_icon VCS_UNSTAGED_ICON _p9k_get_icon VCS_UNSTAGED_ICON
fmt UNSTAGED "$ws$_P9K_RETVAL" fmt UNSTAGED " $_P9K_RETVAL"
ws=' '
fi fi
if [[ $VCS_STATUS_HAS_UNTRACKED == 1 ]]; then if [[ $VCS_STATUS_HAS_UNTRACKED == 1 ]]; then
_p9k_get_icon VCS_UNTRACKED_ICON _p9k_get_icon VCS_UNTRACKED_ICON
fmt UNTRACKED "$ws$_P9K_RETVAL" fmt UNTRACKED " $_P9K_RETVAL"
ws=' '
fi fi
if [[ $VCS_STATUS_COMMITS_AHEAD -gt 0 ]]; then if [[ $VCS_STATUS_COMMITS_AHEAD -gt 0 ]]; then
_p9k_get_icon VCS_OUTGOING_CHANGES_ICON _p9k_get_icon VCS_OUTGOING_CHANGES_ICON
fmt OUTGOING_CHANGES "$ws$_P9K_RETVAL$VCS_STATUS_COMMITS_AHEAD" fmt OUTGOING_CHANGES " $_P9K_RETVAL$VCS_STATUS_COMMITS_AHEAD"
ws=' '
fi fi
if [[ $VCS_STATUS_COMMITS_BEHIND -gt 0 ]]; then if [[ $VCS_STATUS_COMMITS_BEHIND -gt 0 ]]; then
_p9k_get_icon VCS_INCOMING_CHANGES_ICON _p9k_get_icon VCS_INCOMING_CHANGES_ICON
fmt INCOMING_CHANGES "$ws$_P9K_RETVAL$VCS_STATUS_COMMITS_BEHIND" fmt INCOMING_CHANGES " $_P9K_RETVAL$VCS_STATUS_COMMITS_BEHIND"
ws=' '
fi fi
if [[ $VCS_STATUS_STASHES -gt 0 ]]; then if [[ $VCS_STATUS_STASHES -gt 0 ]]; then
_p9k_get_icon VCS_STASH_ICON _p9k_get_icon VCS_STASH_ICON
fmt STASH "$ws$_P9K_RETVAL$VCS_STATUS_STASHES" fmt STASH " $_P9K_RETVAL$VCS_STATUS_STASHES"
ws=' '
fi fi
fi fi