mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-07 21:18:01 +08:00
Compare commits
4 Commits
375f9c429c
...
7f472f15b0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f472f15b0 | ||
|
|
f84341c574 | ||
|
|
92aed2e936 | ||
|
|
d7c1e0404a |
10
lib/git.zsh
10
lib/git.zsh
@ -117,7 +117,7 @@ function _omz_git_prompt_status() {
|
||||
fi
|
||||
|
||||
# For each status prefix, do a regex comparison
|
||||
for status_prefix in ${(k)prefix_constant_map}; do
|
||||
for status_prefix in "${(@k)prefix_constant_map}"; do
|
||||
local status_constant="${prefix_constant_map[$status_prefix]}"
|
||||
local status_regex=$'(^|\n)'"$status_prefix"
|
||||
|
||||
@ -310,6 +310,14 @@ function git_commits_behind() {
|
||||
fi
|
||||
}
|
||||
|
||||
function git_commits_status() {
|
||||
local ahead=$(git_commits_ahead)
|
||||
local behind=$(git_commits_behind)
|
||||
if [[ -n "$ahead$behind" ]]; then
|
||||
echo "$ZSH_THEME_GIT_COMMITS_STATUS_PREFIX$ahead$behind$ZSH_THEME_GIT_COMMITS_STATUS_SUFFIX"
|
||||
fi
|
||||
}
|
||||
|
||||
# Outputs if current branch is ahead of remote
|
||||
function git_prompt_ahead() {
|
||||
if [[ -n "$(__git_prompt_git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then
|
||||
|
||||
@ -77,7 +77,15 @@ EOF
|
||||
(*.lzma) unlzma "$full_path" ;;
|
||||
(*.z) uncompress "$full_path" ;;
|
||||
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
|
||||
(*.rar) unrar x -ad "$full_path" ;;
|
||||
(*.rar)
|
||||
if (( $+commands[unrar] )); then
|
||||
unrar x -ad "$full_path"
|
||||
elif (( $+commands[unar] )); then
|
||||
unar -o . "$full_path"
|
||||
else
|
||||
echo "extract: cannot extract RAR files: install unrar or unar" >&2
|
||||
success=1
|
||||
fi ;;
|
||||
(*.rpm)
|
||||
rpm2cpio "$full_path" | cpio --quiet -id ;;
|
||||
(*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user