blob: c310b53b6c7c773605613afbf197aa84082d4ba8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#
# Git
#
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_GIT_SHOW="${SPACESHIP_GIT_SHOW=true}"
SPACESHIP_GIT_PREFIX="${SPACESHIP_GIT_PREFIX="on "}"
SPACESHIP_GIT_SUFFIX="${SPACESHIP_GIT_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_GIT_SYMBOL="${SPACESHIP_GIT_SYMBOL=" "}"
# ------------------------------------------------------------------------------
# Dependencies
# ------------------------------------------------------------------------------
source "$SPACESHIP_ROOT/sections/git_branch.zsh"
source "$SPACESHIP_ROOT/sections/git_status.zsh"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show both git branch and git status:
# spaceship_git_branch
# spaceship_git_status
spaceship_git() {
[[ $SPACESHIP_GIT_SHOW == false ]] && return
local git_branch="$(spaceship_git_branch)" git_status="$(spaceship_git_status)"
[[ -z $git_branch ]] && return
spaceship::section \
'white' \
"$SPACESHIP_GIT_PREFIX" \
"${git_branch}${git_status}" \
"$SPACESHIP_GIT_SUFFIX"
}
|