mirror of
https://github.com/eRgo35/dots.git
synced 2025-12-17 07:56:11 +01:00
funny fish
This commit is contained in:
26
.config/fish/functions/_pure_prompt_git.fish
Normal file
26
.config/fish/functions/_pure_prompt_git.fish
Normal file
@@ -0,0 +1,26 @@
|
||||
function _pure_prompt_git \
|
||||
--description 'Print git repository informations: branch name, dirty, upstream ahead/behind'
|
||||
|
||||
set ABORT_FEATURE 2
|
||||
|
||||
if set --query pure_enable_git; and test "$pure_enable_git" != true
|
||||
return
|
||||
end
|
||||
|
||||
if not type -q --no-functions git # skip git-related features when `git` is not available
|
||||
return $ABORT_FEATURE
|
||||
end
|
||||
|
||||
set --local is_git_repository (command git rev-parse --is-inside-work-tree 2>/dev/null)
|
||||
|
||||
if test -n "$is_git_repository"
|
||||
set --local git_prompt (_pure_prompt_git_branch)(_pure_prompt_git_dirty)(_pure_prompt_git_stash)
|
||||
set --local git_pending_commits (_pure_prompt_git_pending_commits)
|
||||
|
||||
if test (_pure_string_width $git_pending_commits) -ne 0
|
||||
set --append git_prompt $git_pending_commits
|
||||
end
|
||||
|
||||
echo $git_prompt
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user