Commit 82a45874 authored by Marc Cornellà's avatar Marc Cornellà
Browse files

Use `grep -q` for silent behavior

parent e1b04cfe
...@@ -28,16 +28,16 @@ bureau_git_status() { ...@@ -28,16 +28,16 @@ bureau_git_status() {
# check status of files # check status of files
_INDEX=$(command git status --porcelain 2> /dev/null) _INDEX=$(command git status --porcelain 2> /dev/null)
if [[ -n "$_INDEX" ]]; then if [[ -n "$_INDEX" ]]; then
if $(echo "$_INDEX" | command grep '^[AMRD]. ' &> /dev/null); then if $(echo "$_INDEX" | command grep -q '^[AMRD]. '); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
fi fi
if $(echo "$_INDEX" | command grep '^.[MTD] ' &> /dev/null); then if $(echo "$_INDEX" | command grep -q '^.[MTD] '); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED"
fi fi
if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then if $(echo "$_INDEX" | command grep -q -E '^\?\? '); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED"
fi fi
if $(echo "$_INDEX" | command grep '^UU ' &> /dev/null); then if $(echo "$_INDEX" | command grep -q '^UU '); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED"
fi fi
else else
...@@ -46,13 +46,13 @@ bureau_git_status() { ...@@ -46,13 +46,13 @@ bureau_git_status() {
# check status of local repository # check status of local repository
_INDEX=$(command git status --porcelain -b 2> /dev/null) _INDEX=$(command git status --porcelain -b 2> /dev/null)
if $(echo "$_INDEX" | command grep '^## .*ahead' &> /dev/null); then if $(echo "$_INDEX" | command grep -q '^## .*ahead'); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
fi fi
if $(echo "$_INDEX" | command grep '^## .*behind' &> /dev/null); then if $(echo "$_INDEX" | command grep -q '^## .*behind'); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND"
fi fi
if $(echo "$_INDEX" | command grep '^## .*diverged' &> /dev/null); then if $(echo "$_INDEX" | command grep -q '^## .*diverged'); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED"
fi fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment