mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-25 09:13:35 +01:00
fix(agnoster): prevent accidental alias use
This commit is contained in:
parent
efa8de0b52
commit
7ef3f49f97
@ -96,7 +96,7 @@ prompt_context() {
|
|||||||
# Git: branch/detached head, dirty status
|
# Git: branch/detached head, dirty status
|
||||||
prompt_git() {
|
prompt_git() {
|
||||||
(( $+commands[git] )) || return
|
(( $+commands[git] )) || return
|
||||||
if [[ "$(git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then
|
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
local PL_BRANCH_CHAR
|
local PL_BRANCH_CHAR
|
||||||
@ -106,12 +106,12 @@ prompt_git() {
|
|||||||
}
|
}
|
||||||
local ref dirty mode repo_path
|
local ref dirty mode repo_path
|
||||||
|
|
||||||
if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
|
if [[ "$(command git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
|
||||||
repo_path=$(git rev-parse --git-dir 2>/dev/null)
|
repo_path=$(command git rev-parse --git-dir 2>/dev/null)
|
||||||
dirty=$(parse_git_dirty)
|
dirty=$(parse_git_dirty)
|
||||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
|
||||||
ref="◈ $(git describe --exact-match --tags HEAD 2> /dev/null)" || \
|
ref="◈ $(command git describe --exact-match --tags HEAD 2> /dev/null)" || \
|
||||||
ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
|
ref="➦ $(command git rev-parse --short HEAD 2> /dev/null)"
|
||||||
if [[ -n $dirty ]]; then
|
if [[ -n $dirty ]]; then
|
||||||
prompt_segment yellow black
|
prompt_segment yellow black
|
||||||
else
|
else
|
||||||
@ -119,8 +119,8 @@ prompt_git() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local ahead behind
|
local ahead behind
|
||||||
ahead=$(git log --oneline @{upstream}.. 2>/dev/null)
|
ahead=$(command git log --oneline @{upstream}.. 2>/dev/null)
|
||||||
behind=$(git log --oneline ..@{upstream} 2>/dev/null)
|
behind=$(command git log --oneline ..@{upstream} 2>/dev/null)
|
||||||
if [[ -n "$ahead" ]] && [[ -n "$behind" ]]; then
|
if [[ -n "$ahead" ]] && [[ -n "$behind" ]]; then
|
||||||
PL_BRANCH_CHAR=$'\u21c5'
|
PL_BRANCH_CHAR=$'\u21c5'
|
||||||
elif [[ -n "$ahead" ]]; then
|
elif [[ -n "$ahead" ]]; then
|
||||||
@ -163,10 +163,10 @@ prompt_bzr() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
local bzr_status status_mod status_all revision
|
local bzr_status status_mod status_all revision
|
||||||
if bzr_status=$(bzr status 2>&1); then
|
if bzr_status=$(command bzr status 2>&1); then
|
||||||
status_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m)
|
status_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m)
|
||||||
status_all=$(echo -n "$bzr_status" | head -n1 | wc -m)
|
status_all=$(echo -n "$bzr_status" | head -n1 | wc -m)
|
||||||
revision=${$(bzr log -r-1 --log-format line | cut -d: -f1):gs/%/%%}
|
revision=${$(command bzr log -r-1 --log-format line | cut -d: -f1):gs/%/%%}
|
||||||
if [[ $status_mod -gt 0 ]] ; then
|
if [[ $status_mod -gt 0 ]] ; then
|
||||||
prompt_segment yellow black "bzr@$revision ✚"
|
prompt_segment yellow black "bzr@$revision ✚"
|
||||||
else
|
else
|
||||||
@ -182,13 +182,13 @@ prompt_bzr() {
|
|||||||
prompt_hg() {
|
prompt_hg() {
|
||||||
(( $+commands[hg] )) || return
|
(( $+commands[hg] )) || return
|
||||||
local rev st branch
|
local rev st branch
|
||||||
if $(hg id >/dev/null 2>&1); then
|
if $(command hg id >/dev/null 2>&1); then
|
||||||
if $(hg prompt >/dev/null 2>&1); then
|
if $(command hg prompt >/dev/null 2>&1); then
|
||||||
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
|
if [[ $(command hg prompt "{status|unknown}") = "?" ]]; then
|
||||||
# if files are not added
|
# if files are not added
|
||||||
prompt_segment red white
|
prompt_segment red white
|
||||||
st='±'
|
st='±'
|
||||||
elif [[ -n $(hg prompt "{status|modified}") ]]; then
|
elif [[ -n $(command hg prompt "{status|modified}") ]]; then
|
||||||
# if any modification
|
# if any modification
|
||||||
prompt_segment yellow black
|
prompt_segment yellow black
|
||||||
st='±'
|
st='±'
|
||||||
@ -196,15 +196,15 @@ prompt_hg() {
|
|||||||
# if working copy is clean
|
# if working copy is clean
|
||||||
prompt_segment green $CURRENT_FG
|
prompt_segment green $CURRENT_FG
|
||||||
fi
|
fi
|
||||||
echo -n ${$(hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
|
echo -n ${$(command hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
|
||||||
else
|
else
|
||||||
st=""
|
st=""
|
||||||
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
rev=$(command hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
||||||
branch=$(hg id -b 2>/dev/null)
|
branch=$(command hg id -b 2>/dev/null)
|
||||||
if `hg st | grep -q "^\?"`; then
|
if command hg st | command grep -q "^\?"; then
|
||||||
prompt_segment red black
|
prompt_segment red black
|
||||||
st='±'
|
st='±'
|
||||||
elif `hg st | grep -q "^[MA]"`; then
|
elif command hg st | command grep -q "^[MA]"; then
|
||||||
prompt_segment yellow black
|
prompt_segment yellow black
|
||||||
st='±'
|
st='±'
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user