themes: Fix wrong usage of command substitutions in conditions

This commit is contained in:
Koichi Murase
2021-12-28 20:29:22 +09:00
parent 85211c1f76
commit 8780308a4f
3 changed files with 5 additions and 5 deletions

View File

@@ -249,7 +249,7 @@ git_status_dirty() {
# Git: branch/detached head, dirty status # Git: branch/detached head, dirty status
prompt_git() { prompt_git() {
local ref dirty local ref dirty
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then if git rev-parse --is-inside-work-tree &>/dev/null; then
ZSH_THEME_GIT_PROMPT_DIRTY='±' ZSH_THEME_GIT_PROMPT_DIRTY='±'
dirty=$(git_status_dirty) dirty=$(git_status_dirty)
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="$(git show-ref --head -s --abbrev |head -n1 2> /dev/null)" ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="$(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"

View File

@@ -137,12 +137,12 @@ prompt_git() {
git update-index --really-refresh -q &>/dev/null; git update-index --really-refresh -q &>/dev/null;
# Check for uncommitted changes in the index. # Check for uncommitted changes in the index.
if ! $(git diff --quiet --ignore-submodules --cached); then if ! git diff --quiet --ignore-submodules --cached; then
s+='+'; s+='+';
fi; fi;
# Check for unstaged changes. # Check for unstaged changes.
if ! $(git diff-files --quiet --ignore-submodules --); then if ! git diff-files --quiet --ignore-submodules --; then
s+='!'; s+='!';
fi; fi;
@@ -152,7 +152,7 @@ prompt_git() {
fi; fi;
# Check for stashed files. # Check for stashed files.
if $(git rev-parse --verify refs/stash &>/dev/null); then if git rev-parse --verify refs/stash &>/dev/null; then
s+='$'; s+='$';
fi; fi;

View File

@@ -49,7 +49,7 @@ function is_integer() { # helper function for todo-txt-count
} }
todo_txt_count() { todo_txt_count() {
if `hash todo.sh 2>&-`; then # is todo.sh installed if _omb_util_command_exists todo.sh; then # is todo.sh installed
count=$(todo.sh ls | egrep "TODO: [0-9]+ of ([0-9]+) tasks shown" | awk '{ print $4 }') count=$(todo.sh ls | egrep "TODO: [0-9]+ of ([0-9]+) tasks shown" | awk '{ print $4 }')
if is_integer $count; then # did we get a sane answer back if is_integer $count; then # did we get a sane answer back
echo "${BRACKET_COLOR}[${STRING_COLOR}T:$count${BRACKET_COLOR}]$normal" echo "${BRACKET_COLOR}[${STRING_COLOR}T:$count${BRACKET_COLOR}]$normal"