mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2024-10-27 20:34:23 +00:00
Add verbose option for Git dirty state (#133)
* Add verbose option for Git dirty state * Simplify git dirty verbose setting check
This commit is contained in:
parent
d1731ae1e1
commit
180f251189
@ -71,6 +71,7 @@ set -g theme_display_git no
|
|||||||
set -g theme_display_git_dirty no
|
set -g theme_display_git_dirty no
|
||||||
set -g theme_display_git_untracked no
|
set -g theme_display_git_untracked no
|
||||||
set -g theme_display_git_ahead_verbose yes
|
set -g theme_display_git_ahead_verbose yes
|
||||||
|
set -g theme_display_git_dirty_verbose yes
|
||||||
set -g theme_git_worktree_support yes
|
set -g theme_git_worktree_support yes
|
||||||
set -g theme_display_vagrant yes
|
set -g theme_display_vagrant yes
|
||||||
set -g theme_display_docker_machine no
|
set -g theme_display_docker_machine no
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
# set -g theme_display_git_dirty no
|
# set -g theme_display_git_dirty no
|
||||||
# set -g theme_display_git_untracked no
|
# set -g theme_display_git_untracked no
|
||||||
# set -g theme_display_git_ahead_verbose yes
|
# set -g theme_display_git_ahead_verbose yes
|
||||||
|
# set -g theme_display_git_dirty_verbose yes
|
||||||
# set -g theme_git_worktree_support yes
|
# set -g theme_git_worktree_support yes
|
||||||
# set -g theme_display_vagrant yes
|
# set -g theme_display_vagrant yes
|
||||||
# set -g theme_display_docker_machine no
|
# set -g theme_display_docker_machine no
|
||||||
@ -239,6 +240,12 @@ function __bobthefish_git_ahead_verbose -S -d 'Print a more verbose ahead/behind
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function __bobthefish_git_dirty_verbose -S -d 'Print a more verbose dirty state for the current working tree'
|
||||||
|
set -l changes (command git diff --numstat | awk '{ added += $1; removed += $2 } END { print "+" added "/-" removed }')
|
||||||
|
[ $status != 0 ]; and return
|
||||||
|
|
||||||
|
echo "$changes "
|
||||||
|
end
|
||||||
|
|
||||||
# ==============================
|
# ==============================
|
||||||
# Segment functions
|
# Segment functions
|
||||||
@ -717,6 +724,9 @@ function __bobthefish_prompt_git -S -a current_dir -d 'Display the actual git st
|
|||||||
set -l show_dirty (command git config --bool bash.showDirtyState ^/dev/null)
|
set -l show_dirty (command git config --bool bash.showDirtyState ^/dev/null)
|
||||||
if [ "$show_dirty" != 'false' ]
|
if [ "$show_dirty" != 'false' ]
|
||||||
set dirty (command git diff --no-ext-diff --quiet --exit-code ^/dev/null; or echo -n "$__bobthefish_git_dirty_glyph")
|
set dirty (command git diff --no-ext-diff --quiet --exit-code ^/dev/null; or echo -n "$__bobthefish_git_dirty_glyph")
|
||||||
|
if [ "$dirty" -a "$theme_display_git_dirty_verbose" = 'yes' ]
|
||||||
|
set dirty "$dirty"(__bobthefish_git_dirty_verbose)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user