Browse Source

fix(agnoster): prevent accidental alias use

Marc Cornellà 2 weeks ago
parent
commit
7ef3f49f97
1 changed files with 19 additions and 19 deletions
  1. 19 19
      themes/agnoster.zsh-theme

+ 19 - 19
themes/agnoster.zsh-theme

@@ -96,7 +96,7 @@ prompt_context() {
 # Git: branch/detached head, dirty status
 prompt_git() {
   (( $+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
   fi
   local PL_BRANCH_CHAR
@@ -106,12 +106,12 @@ prompt_git() {
   }
   local ref dirty mode repo_path
 
-   if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
-    repo_path=$(git rev-parse --git-dir 2>/dev/null)
+   if [[ "$(command git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
+    repo_path=$(command git rev-parse --git-dir 2>/dev/null)
     dirty=$(parse_git_dirty)
-    ref=$(git symbolic-ref HEAD 2> /dev/null) || \
-    ref="◈ $(git describe --exact-match --tags HEAD 2> /dev/null)" || \
-    ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
+    ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
+    ref="◈ $(command git describe --exact-match --tags HEAD 2> /dev/null)" || \
+    ref="➦ $(command git rev-parse --short HEAD 2> /dev/null)"
     if [[ -n $dirty ]]; then
       prompt_segment yellow black
     else
@@ -119,8 +119,8 @@ prompt_git() {
     fi
 
     local ahead behind
-    ahead=$(git log --oneline @{upstream}.. 2>/dev/null)
-    behind=$(git log --oneline ..@{upstream} 2>/dev/null)
+    ahead=$(command git log --oneline @{upstream}.. 2>/dev/null)
+    behind=$(command git log --oneline ..@{upstream} 2>/dev/null)
     if [[ -n "$ahead" ]] && [[ -n "$behind" ]]; then
       PL_BRANCH_CHAR=$'\u21c5'
     elif [[ -n "$ahead" ]]; then
@@ -163,10 +163,10 @@ prompt_bzr() {
   done
 
   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_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
       prompt_segment yellow black "bzr@$revision ✚"
     else
@@ -182,13 +182,13 @@ prompt_bzr() {
 prompt_hg() {
   (( $+commands[hg] )) || return
   local rev st branch
-  if $(hg id >/dev/null 2>&1); then
-    if $(hg prompt >/dev/null 2>&1); then
-      if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
+  if $(command hg id >/dev/null 2>&1); then
+    if $(command hg prompt >/dev/null 2>&1); then
+      if [[ $(command hg prompt "{status|unknown}") = "?" ]]; then
         # if files are not added
         prompt_segment red white
         st='±'
-      elif [[ -n $(hg prompt "{status|modified}") ]]; then
+      elif [[ -n $(command hg prompt "{status|modified}") ]]; then
         # if any modification
         prompt_segment yellow black
         st='±'
@@ -196,15 +196,15 @@ prompt_hg() {
         # if working copy is clean
         prompt_segment green $CURRENT_FG
       fi
-      echo -n ${$(hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
+      echo -n ${$(command hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
     else
       st=""
-      rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
-      branch=$(hg id -b 2>/dev/null)
-      if `hg st | grep -q "^\?"`; then
+      rev=$(command hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
+      branch=$(command hg id -b 2>/dev/null)
+      if command hg st | command grep -q "^\?"; then
         prompt_segment red black
         st='±'
-      elif `hg st | grep -q "^[MA]"`; then
+      elif command hg st | command grep -q "^[MA]"; then
         prompt_segment yellow black
         st='±'
       else