7ef3f49f97ff34db3785b1cea444eb4972b1937b

Author
Marc Cornellà <marc@mcornella.com>
Committer
Marc Cornellà <marc@mcornella.com>
Date

Message

fix(agnoster): prevent accidental alias use

Diff

 1diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
 2index bd0405efb5cd0c54e884efcd1f35241ebed9f5ca..c2a5421637d0e62cc31882234bffd081223dd988 100644
 3--- a/themes/agnoster.zsh-theme
 4+++ b/themes/agnoster.zsh-theme
 5@@ -96,7 +96,7 @@ prompt_context() {
 6 # Git: branch/detached head, dirty status
 7 prompt_git() {
 8   (( $+commands[git] )) || return
 9-  if [[ "$(git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then
10+  if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then
11     return
12   fi
13   local PL_BRANCH_CHAR
14@@ -106,12 +106,12 @@ prompt_git() {
15   }
16   local ref dirty mode repo_path
17 
18-   if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
19-    repo_path=$(git rev-parse --git-dir 2>/dev/null)
20+   if [[ "$(command git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
21+    repo_path=$(command git rev-parse --git-dir 2>/dev/null)
22     dirty=$(parse_git_dirty)
23-    ref=$(git symbolic-ref HEAD 2> /dev/null) || \
24-    ref="◈ $(git describe --exact-match --tags HEAD 2> /dev/null)" || \
25-    ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
26+    ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
27+    ref="◈ $(command git describe --exact-match --tags HEAD 2> /dev/null)" || \
28+    ref="➦ $(command git rev-parse --short HEAD 2> /dev/null)"
29     if [[ -n $dirty ]]; then
30       prompt_segment yellow black
31     else
32@@ -119,8 +119,8 @@ prompt_git() {
33     fi
34 
35     local ahead behind
36-    ahead=$(git log --oneline @{upstream}.. 2>/dev/null)
37-    behind=$(git log --oneline ..@{upstream} 2>/dev/null)
38+    ahead=$(command git log --oneline @{upstream}.. 2>/dev/null)
39+    behind=$(command git log --oneline ..@{upstream} 2>/dev/null)
40     if [[ -n "$ahead" ]] && [[ -n "$behind" ]]; then
41       PL_BRANCH_CHAR=$'\u21c5'
42     elif [[ -n "$ahead" ]]; then
43@@ -163,10 +163,10 @@ prompt_bzr() {
44   done
45 
46   local bzr_status status_mod status_all revision
47-  if bzr_status=$(bzr status 2>&1); then
48+  if bzr_status=$(command bzr status 2>&1); then
49     status_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m)
50     status_all=$(echo -n "$bzr_status" | head -n1 | wc -m)
51-    revision=${$(bzr log -r-1 --log-format line | cut -d: -f1):gs/%/%%}
52+    revision=${$(command bzr log -r-1 --log-format line | cut -d: -f1):gs/%/%%}
53     if [[ $status_mod -gt 0 ]] ; then
54       prompt_segment yellow black "bzr@$revision ✚"
55     else
56@@ -182,13 +182,13 @@ prompt_bzr() {
57 prompt_hg() {
58   (( $+commands[hg] )) || return
59   local rev st branch
60-  if $(hg id >/dev/null 2>&1); then
61-    if $(hg prompt >/dev/null 2>&1); then
62-      if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
63+  if $(command hg id >/dev/null 2>&1); then
64+    if $(command hg prompt >/dev/null 2>&1); then
65+      if [[ $(command hg prompt "{status|unknown}") = "?" ]]; then
66         # if files are not added
67         prompt_segment red white
68         st='±'
69-      elif [[ -n $(hg prompt "{status|modified}") ]]; then
70+      elif [[ -n $(command hg prompt "{status|modified}") ]]; then
71         # if any modification
72         prompt_segment yellow black
73         st='±'
74@@ -196,15 +196,15 @@ prompt_hg() {
75         # if working copy is clean
76         prompt_segment green $CURRENT_FG
77       fi
78-      echo -n ${$(hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
79+      echo -n ${$(command hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
80     else
81       st=""
82-      rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
83-      branch=$(hg id -b 2>/dev/null)
84-      if `hg st | grep -q "^\?"`; then
85+      rev=$(command hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
86+      branch=$(command hg id -b 2>/dev/null)
87+      if command hg st | command grep -q "^\?"; then
88         prompt_segment red black
89         st='±'
90-      elif `hg st | grep -q "^[MA]"`; then
91+      elif command hg st | command grep -q "^[MA]"; then
92         prompt_segment yellow black
93         st='±'
94       else