diff --git a/completions/svn.completion.sh b/completions/svn.completion.sh index 9892c6f..e8bff6a 100644 --- a/completions/svn.completion.sh +++ b/completions/svn.completion.sh @@ -79,7 +79,7 @@ function _svn_grcut() function _svn_info() { local what=$1 line= - LANG=C LC_MESSAGES=C svn info --non-interactive 2> /dev/null | \ + LANG=C LC_MESSAGES=C command svn info --non-interactive 2> /dev/null | \ while read line ; do [[ $line == *"$what: "* ]] && echo ${line#*: } done @@ -689,7 +689,7 @@ _svn() # build status command and options # "--quiet" removes 'unknown' files - local status='svn status --non-interactive' + local status='command svn status --non-interactive' [[ $SVN_BASH_COMPL_EXT == *recurse* ]] || \ status="$status --non-recursive" diff --git a/lib/git.sh b/lib/git.sh index fa433ff..8a1fcf0 100644 --- a/lib/git.sh +++ b/lib/git.sh @@ -82,7 +82,7 @@ function git_current_branch() { # Gets the number of commits ahead from remote function git_commits_ahead() { if command git rev-parse --git-dir &>/dev/null; then - local commits="$(git rev-list --count @{upstream}..HEAD)" + local commits="$(command git rev-list --count @{upstream}..HEAD)" if [[ "$commits" != 0 ]]; then echo "$OSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$OSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" fi @@ -92,7 +92,7 @@ function git_commits_ahead() { # Gets the number of commits behind remote function git_commits_behind() { if command git rev-parse --git-dir &>/dev/null; then - local commits="$(git rev-list --count HEAD..@{upstream})" + local commits="$(command git rev-list --count HEAD..@{upstream})" if [[ "$commits" != 0 ]]; then echo "$OSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$OSH_THEME_GIT_COMMITS_BEHIND_SUFFIX" fi diff --git a/lib/omb-prompt-base.sh b/lib/omb-prompt-base.sh index 2342dcf..43df02f 100644 --- a/lib/omb-prompt-base.sh +++ b/lib/omb-prompt-base.sh @@ -329,8 +329,8 @@ function svn_prompt_vars { fi SCM_PREFIX=${SVN_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} SCM_SUFFIX=${SVN_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} - SCM_BRANCH=$(svn info 2> /dev/null | awk -F/ '/^URL:/ { for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') || return - SCM_CHANGE=$(svn info 2> /dev/null | sed -ne 's#^Revision: ##p' ) + SCM_BRANCH=$(command svn info 2> /dev/null | awk -F/ '/^URL:/ { for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') || return + SCM_CHANGE=$(command svn info 2> /dev/null | sed -ne 's#^Revision: ##p' ) } # this functions returns absolute location of .hg directory if one exists diff --git a/themes/agnoster/agnoster.theme.sh b/themes/agnoster/agnoster.theme.sh index ef1e257..7758b37 100644 --- a/themes/agnoster/agnoster.theme.sh +++ b/themes/agnoster/agnoster.theme.sh @@ -327,25 +327,25 @@ function prompt_histdt { function git_status_dirty { - dirty=$(git status -s 2> /dev/null | tail -n 1) + dirty=$(command git status -s 2> /dev/null | tail -n 1) [[ -n $dirty ]] && echo " ●" } function git_stash_dirty { - stash=$(git stash list 2> /dev/null | tail -n 1) + stash=$(command git stash list 2> /dev/null | tail -n 1) [[ -n $stash ]] && echo " ⚑" } # Git: branch/detached head, dirty status function prompt_git { local ref dirty - if git rev-parse --is-inside-work-tree &>/dev/null; then + if command git rev-parse --is-inside-work-tree &>/dev/null; then ZSH_THEME_GIT_PROMPT_DIRTY='±' - dirty=$(git_status_dirty) - stash=$(git_stash_dirty) - ref=$(git symbolic-ref HEAD 2> /dev/null) || - ref="➦ $(git describe --exact-match --tags HEAD 2> /dev/null)" || - ref="➦ $(git show-ref --head -s --abbrev | head -n1 2> /dev/null)" + dirty=$(command git_status_dirty) + stash=$(command git_stash_dirty) + ref=$(command git symbolic-ref HEAD 2> /dev/null) || + ref="➦ $(command git describe --exact-match --tags HEAD 2> /dev/null)" || + ref="➦ $(command git show-ref --head -s --abbrev | head -n1 2> /dev/null)" if [[ -n $dirty ]]; then prompt_segment yellow black else diff --git a/themes/cooperkid/cooperkid.theme.sh b/themes/cooperkid/cooperkid.theme.sh index 05ae618..4e5339c 100644 --- a/themes/cooperkid/cooperkid.theme.sh +++ b/themes/cooperkid/cooperkid.theme.sh @@ -14,7 +14,7 @@ GIT_SHA_PREFIX="${_omb_prompt_navy}" GIT_SHA_SUFFIX="${_omb_prompt_reset_color}" function git_short_sha() { - SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX" + SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX" } function _omb_theme_PROMPT_COMMAND() { diff --git a/themes/cupcake/cupcake.theme.sh b/themes/cupcake/cupcake.theme.sh index 97bd6eb..b50f829 100644 --- a/themes/cupcake/cupcake.theme.sh +++ b/themes/cupcake/cupcake.theme.sh @@ -63,7 +63,7 @@ function winname { # Displays the current prompt function _omb_theme_PROMPT_COMMAND() { - PS1="\n${icon_start}$(_omb_prompt_print_python_venv)${icon_user}${_omb_prompt_bold_brown}\u${_omb_prompt_normal}${icon_host}${_omb_prompt_bold_teal}\h${_omb_prompt_normal}${icon_directory}${_omb_prompt_bold_purple}\W${_omb_prompt_normal}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on ${icon_branch} \")${_omb_prompt_white}$(scm_prompt_info)${_omb_prompt_normal}\n${icon_end}" + PS1="\n${icon_start}$(_omb_prompt_print_python_venv)${icon_user}${_omb_prompt_bold_brown}\u${_omb_prompt_normal}${icon_host}${_omb_prompt_bold_teal}\h${_omb_prompt_normal}${icon_directory}${_omb_prompt_bold_purple}\W${_omb_prompt_normal}\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on ${icon_branch} \")${_omb_prompt_white}$(scm_prompt_info)${_omb_prompt_normal}\n${icon_end}" PS2="${icon_end}" } diff --git a/themes/doubletime/doubletime.theme.sh b/themes/doubletime/doubletime.theme.sh index d8f2801..2685169 100644 --- a/themes/doubletime/doubletime.theme.sh +++ b/themes/doubletime/doubletime.theme.sh @@ -33,7 +33,7 @@ function doubletime_scm_prompt { if [ $CHAR = $SCM_NONE_CHAR ]; then return elif [ $CHAR = $SCM_GIT_CHAR ]; then - echo "$(git_prompt_status)" + echo "$(command git_prompt_status)" else echo "[$(scm_prompt_info)]" fi @@ -55,7 +55,7 @@ _omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND function git_prompt_status { local git_status_output - git_status_output=$(git status 2> /dev/null ) + git_status_output=$(command git status 2> /dev/null ) if [ -n "$(echo $git_status_output | grep 'Changes not staged')" ]; then git_status="${_omb_prompt_bold_brown}$(scm_prompt_info) ✗" elif [ -n "$(echo $git_status_output | grep 'Changes to be committed')" ]; then diff --git a/themes/hawaii50/hawaii50.theme.sh b/themes/hawaii50/hawaii50.theme.sh index b89c200..c3fbed0 100644 --- a/themes/hawaii50/hawaii50.theme.sh +++ b/themes/hawaii50/hawaii50.theme.sh @@ -118,15 +118,15 @@ function virtual_prompt_info() { # Parse git info function git_prompt_info() { - if [[ -n $(git status -s 2> /dev/null |grep -v ^# |grep -v "working directory clean") ]]; then + if [[ -n $(command git status -s 2> /dev/null |grep -v ^# |grep -v "working directory clean") ]]; then local state=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} else local state=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} fi local prefix=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} local suffix=${GIT_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} - local ref=$(git symbolic-ref HEAD 2> /dev/null) || return - local commit_id=$(git rev-parse HEAD 2>/dev/null) || return + local ref=$(command git symbolic-ref HEAD 2> /dev/null) || return + local commit_id=$(command git rev-parse HEAD 2>/dev/null) || return echo -e "$prefix${REF_COLOR}${ref#refs/heads/}${DEFAULT_COLOR}:${commit_id:0:$MAX_GIT_HEX_LENGTH}$state$suffix" } @@ -148,17 +148,17 @@ function hg_prompt_info() { # Parse svn info function svn_prompt_info() { - if [[ -n $(svn status --ignore-externals -q 2> /dev/null) ]]; then + if [[ -n $(command svn status --ignore-externals -q 2> /dev/null) ]]; then local state=${SVN_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} else local state=${SVN_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} fi local prefix=${SVN_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} local suffix=${SVN_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} - local ref=$(svn info 2> /dev/null | awk -F/ '/^URL:/ { for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') || return + local ref=$(command svn info 2> /dev/null | awk -F/ '/^URL:/ { for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') || return [[ -z $ref ]] && return - local revision=$(svn info 2> /dev/null | sed -ne 's#^Revision: ##p' ) + local revision=$(command svn info 2> /dev/null | sed -ne 's#^Revision: ##p' ) echo -e "$prefix${REF_COLOR}$ref${DEFAULT_COLOR}:$revision$state$suffix" } diff --git a/themes/mbriggs/mbriggs.theme.sh b/themes/mbriggs/mbriggs.theme.sh index aa30119..8b31e49 100644 --- a/themes/mbriggs/mbriggs.theme.sh +++ b/themes/mbriggs/mbriggs.theme.sh @@ -14,7 +14,7 @@ GIT_SHA_PREFIX=" ${_omb_prompt_olive}" GIT_SHA_SUFFIX="${_omb_prompt_reset_color}" function git_short_sha() { - SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX" + SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX" } function _omb_theme_PROMPT_COMMAND() { diff --git a/themes/rana/rana.theme.sh b/themes/rana/rana.theme.sh index 2bf6a16..3556fe4 100644 --- a/themes/rana/rana.theme.sh +++ b/themes/rana/rana.theme.sh @@ -116,31 +116,31 @@ function prompt_git { local branchName='' # Check if the current directory is in a Git repository. - if git rev-parse --is-inside-work-tree &>/dev/null; then + if command git rev-parse --is-inside-work-tree &>/dev/null; then # check if the current directory is in .git before running git checks - if [[ $(git rev-parse --is-inside-git-dir 2> /dev/null) == false ]]; then + if [[ $(command git rev-parse --is-inside-git-dir 2> /dev/null) == false ]]; then # Ensure the index is up to date. - git update-index --really-refresh -q &>/dev/null + command git update-index --really-refresh -q &>/dev/null # Check for uncommitted changes in the index. - if ! git diff --quiet --ignore-submodules --cached; then + if ! command git diff --quiet --ignore-submodules --cached; then s+='+' fi # Check for unstaged changes. - if ! git diff-files --quiet --ignore-submodules --; then + if ! command git diff-files --quiet --ignore-submodules --; then s+='!' fi # Check for untracked files. - if [[ $(git ls-files --others --exclude-standard) ]]; then + if [[ $(command git ls-files --others --exclude-standard) ]]; then s+='?' fi # Check for stashed files. - if git rev-parse --verify refs/stash &>/dev/null; then + if command git rev-parse --verify refs/stash &>/dev/null; then s+='$' fi @@ -150,8 +150,8 @@ function prompt_git { # If HEAD isn’t a symbolic ref, get the short SHA for the latest commit # Otherwise, just give up. branchName=$( - git symbolic-ref --quiet --short HEAD 2> /dev/null || - git rev-parse --short HEAD 2> /dev/null || + command git symbolic-ref --quiet --short HEAD 2> /dev/null || + command git rev-parse --short HEAD 2> /dev/null || echo '(unknown)') [[ $s ]] && s=" [$s]" diff --git a/themes/sexy/sexy.theme.sh b/themes/sexy/sexy.theme.sh index ec74211..b7a80f9 100644 --- a/themes/sexy/sexy.theme.sh +++ b/themes/sexy/sexy.theme.sh @@ -27,16 +27,16 @@ OMB_PROMPT_CONDAENV_USE_BASENAME=true OMB_PROMPT_SHOW_PYTHON_VENV=${OMB_PROMPT_SHOW_PYTHON_VENV:=false} function parse_git_dirty { - [[ $(git status 2> /dev/null | tail -n1 | cut -c 1-17) != "nothing to commit" ]] && echo "*" + [[ $(command git status 2> /dev/null | tail -n1 | cut -c 1-17) != "nothing to commit" ]] && echo "*" } function parse_git_branch { - git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" + command git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" } function _omb_theme_PROMPT_COMMAND() { local python_venv _omb_prompt_get_python_venv - PS1="$python_venv${MAGENTA}\u ${WHITE}at ${ORANGE}\h ${WHITE}in ${GREEN}\w${WHITE}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")${PURPLE}\$(parse_git_branch)${WHITE}\n\$ ${RESET}" + PS1="$python_venv${MAGENTA}\u ${WHITE}at ${ORANGE}\h ${WHITE}in ${GREEN}\w${WHITE}\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on \")${PURPLE}\$(parse_git_branch)${WHITE}\n\$ ${RESET}" } _omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND