From 6065d003e87f3acd975acf289facdb3835941e42 Mon Sep 17 00:00:00 2001 From: Gurkirat Singh Date: Sun, 10 Jan 2021 00:34:14 +0530 Subject: [PATCH 01/10] fixed existing completion and added conditional completion --- completion/available/vuejs.completion.bash | 50 ++++++++++++++++++---- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/completion/available/vuejs.completion.bash b/completion/available/vuejs.completion.bash index 69794785..78c277db 100644 --- a/completion/available/vuejs.completion.bash +++ b/completion/available/vuejs.completion.bash @@ -1,14 +1,48 @@ #!/usr/bin/bash -if command -v vue > /dev/null; then +if _command_exists vue; then __vuejs_completion() { - local OPTS=("--version --help create add invoke inspect serve build ui init config upgrade info") - COMPREPLY=() - for _opt_ in ${OPTS[@]}; do - if [[ "$_opt_" == "$2"* ]]; then - COMPREPLY+=("$_opt_") - fi - done + local prev=$(_get_pword) + local curr=$(_get_cword) + + case $prev in + create) + COMPREPLY=($(compgen -W "-p -d -i -m -r -g -n -f -c -x -b -h --help --preset --default --inilinePreset --packageManager --registry --git --no-git --force --merge --clone --proxy --bare --skipGetStarted" -- "$curr")) + ;; + add|invoke) + COMPREPLY=($(compgen -W "--registry -h --help" -- "$curr")) + ;; + inspect) + COMPREPLY=($(compgen -W "-v --help --verbose --mode --rule --plugin --plugins --rules" -- "$curr")) + ;; + serve) + COMPREPLY=($(compgen -W "-o -h --help --open -c --copy -p --port" -- "$curr")) + ;; + build) + COMPREPLY=($(compgen -W "-t --target -n --name -d --dest -h --help" -- "$curr")) + ;; + ui) + COMPREPLY=($(compgen -W "-H --host -p --port -D --dev --quiet --headless -h --help" -- "$curr")) + ;; + init) + COMPREPLY=($(compgen -W "-c --clone --offline -h --help" -- "$curr")) + ;; + config) + COMPREPLY=($(compgen -W "-g --get -s --set -d --delete -e --edit --json -h --help" -- "$curr")) + ;; + outdated) + COMPREPLY=($(compgen -W "--next -h --help" -- "$curr")) + ;; + upgrade) + COMPREPLY=($(compgen -W "-t --to -f --from -r --registry --all --next -h --help" -- "$curr")) + ;; + migrate) + COMPREPLY=($(compgen -W "-f --from -h --help" -- "$curr")) + ;; + *) + COMPREPLY=($(compgen -W "-h --help -v --version create add invoke inspect serve build ui init config outdated upgrade migrate info" -- "$curr")) + ;; + esac } complete -F __vuejs_completion vue From 08ff08e0438e91aec50929bb3479d28db6f5b780 Mon Sep 17 00:00:00 2001 From: Marcos Pereira Date: Mon, 11 Jan 2021 11:11:19 -0500 Subject: [PATCH 02/10] Support multiple sdkman output formats sdkman has a specific output format for Java candidate since there are multiple vendors and builds. For example, when running `sdk list maven`, the format is a simple list like: 3.6.2 3.6.1 3.6.0 3.5.4 3.5.3 3.5.2 3.5.0 3.3.9 But for `sbt list java`, the output is a table like: ================================================================================ Vendor | Use | Version | Dist | Status | Identifier -------------------------------------------------------------------------------- AdoptOpenJDK | | 15.0.1.j9 | adpt | | 15.0.1.j9-adpt | | 15.0.1.hs | adpt | installed | 15.0.1.hs-adpt ... Amazon | | 15.0.1 | amzn | | 15.0.1-amzn | | 11.0.9 | amzn | | 11.0.9-amzn ... Azul Zulu | | 15.0.1 | zulu | | 15.0.1-zulu | | 15.0.1.fx | zulu | | 15.0.1.fx-zulu ... Therefore, the completion script has to handle both formats. --- completion/available/sdkman.completion.bash | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/completion/available/sdkman.completion.bash b/completion/available/sdkman.completion.bash index 16affe8d..7f0157f3 100644 --- a/completion/available/sdkman.completion.bash +++ b/completion/available/sdkman.completion.bash @@ -59,8 +59,18 @@ _sdkman_candidate_all_versions() { if [ "$SDKMAN_OFFLINE_MODE" = "true" ]; then CANDIDATE_VERSIONS=$CANDIDATE_LOCAL_VERSIONS else - CANDIDATE_ONLINE_VERSIONS="$(__sdkman_list_versions "$1" | grep " " | grep "\." | cut -c 62-)" - CANDIDATE_VERSIONS="$(echo "$CANDIDATE_ONLINE_VERSIONS $CANDIDATE_LOCAL_VERSIONS" | tr ' ' '\n' | sort | uniq -u) " + # sdkman has a specific output format for Java candidate since + # there are multiple vendors and builds. + if [ "$candidate" = "java" ]; then + CANDIDATE_ONLINE_VERSIONS="$(__sdkman_list_versions "$candidate" | grep " " | grep "\." | cut -c 62-)" + else + CANDIDATE_ONLINE_VERSIONS="$(__sdkman_list_versions "$candidate" | grep " " | grep "\." | cut -c 6-)" + fi + # the last grep is used to filter out sdkman flags, such as: + # "+" - local version + # "*" - installed + # ">" - currently in use + CANDIDATE_VERSIONS="$(echo "$CANDIDATE_ONLINE_VERSIONS $CANDIDATE_LOCAL_VERSIONS" | tr ' ' '\n' | grep -v -e '^[[:space:]|\*|\>|\+]*$' | sort | uniq -u) " fi } From 3f2986247849fdab473bf970615918bc91ba28a2 Mon Sep 17 00:00:00 2001 From: Marcos Pereira Date: Mon, 11 Jan 2021 15:12:39 -0500 Subject: [PATCH 03/10] Add themes/base.theme.bash to clean files --- clean_files.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/clean_files.txt b/clean_files.txt index 85522112..721bbe86 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -30,6 +30,7 @@ themes/agnoster themes/90210 themes/powerline themes/barbuk +themes/base.theme.bash # plugins # From 5a761b7ae3d29435381b92af6fbd8a9158b6ce42 Mon Sep 17 00:00:00 2001 From: Marcos Pereira Date: Mon, 11 Jan 2021 15:13:01 -0500 Subject: [PATCH 04/10] Run code fomatter for themes/base.theme.bash --- themes/base.theme.bash | 658 +++++++++++++++++++++-------------------- 1 file changed, 336 insertions(+), 322 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 58246720..0382a6af 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -92,214 +92,228 @@ SVN_EXE=$(which svn 2> /dev/null || true) # Check for broken SVN exe that is caused by some versions of Xcode. # See https://github.com/Bash-it/bash-it/issues/1612 for more details. -if [[ -x "$SVN_EXE" ]] ; then - if ! "$SVN_EXE" --version > /dev/null 2>&1 ; then - # Unset the SVN exe variable so that SVN commands are avoided. - SVN_EXE="" - fi +if [[ -x "$SVN_EXE" ]]; then + if ! "$SVN_EXE" --version > /dev/null 2>&1; then + # Unset the SVN exe variable so that SVN commands are avoided. + SVN_EXE="" + fi fi function scm { - if [[ "$SCM_CHECK" = false ]]; then SCM=$SCM_NONE - elif [[ -f .git/HEAD ]] && [[ -x "$GIT_EXE" ]]; then SCM=$SCM_GIT - elif [[ -x "$GIT_EXE" ]] && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then SCM=$SCM_GIT - elif [[ -x "$P4_EXE" ]] && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then SCM=$SCM_P4 - elif [[ -d .hg ]] && [[ -x "$HG_EXE" ]]; then SCM=$SCM_HG - elif [[ -x "$HG_EXE" ]] && [[ -n "$(hg root 2> /dev/null)" ]]; then SCM=$SCM_HG - elif [[ -d .svn ]] && [[ -x "$SVN_EXE" ]]; then SCM=$SCM_SVN - elif [[ -x "$SVN_EXE" ]] && [[ -n "$(svn info --show-item wc-root 2>/dev/null)" ]]; then SCM=$SCM_SVN - else SCM=$SCM_NONE - fi + if [[ "$SCM_CHECK" = false ]]; then + SCM=$SCM_NONE + elif [[ -f .git/HEAD ]] && [[ -x "$GIT_EXE" ]]; then + SCM=$SCM_GIT + elif [[ -x "$GIT_EXE" ]] && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then + SCM=$SCM_GIT + elif [[ -x "$P4_EXE" ]] && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then + SCM=$SCM_P4 + elif [[ -d .hg ]] && [[ -x "$HG_EXE" ]]; then + SCM=$SCM_HG + elif [[ -x "$HG_EXE" ]] && [[ -n "$(hg root 2> /dev/null)" ]]; then + SCM=$SCM_HG + elif [[ -d .svn ]] && [[ -x "$SVN_EXE" ]]; then + SCM=$SCM_SVN + elif [[ -x "$SVN_EXE" ]] && [[ -n "$(svn info --show-item wc-root 2> /dev/null)" ]]; then + SCM=$SCM_SVN + else + SCM=$SCM_NONE + fi } function scm_prompt_char { - if [[ -z $SCM ]]; then scm; fi - if [[ $SCM == $SCM_GIT ]]; then SCM_CHAR=$SCM_GIT_CHAR - elif [[ $SCM == $SCM_P4 ]]; then SCM_CHAR=$SCM_P4_CHAR - elif [[ $SCM == $SCM_HG ]]; then SCM_CHAR=$SCM_HG_CHAR - elif [[ $SCM == $SCM_SVN ]]; then SCM_CHAR=$SCM_SVN_CHAR - else SCM_CHAR=$SCM_NONE_CHAR - fi + if [[ -z $SCM ]]; then scm; fi + if [[ $SCM == $SCM_GIT ]]; then + SCM_CHAR=$SCM_GIT_CHAR + elif [[ $SCM == $SCM_P4 ]]; then + SCM_CHAR=$SCM_P4_CHAR + elif [[ $SCM == $SCM_HG ]]; then + SCM_CHAR=$SCM_HG_CHAR + elif [[ $SCM == $SCM_SVN ]]; then + SCM_CHAR=$SCM_SVN_CHAR + else + SCM_CHAR=$SCM_NONE_CHAR + fi } function scm_prompt_vars { - scm - scm_prompt_char - SCM_DIRTY=0 - SCM_STATE='' - [[ $SCM == $SCM_GIT ]] && git_prompt_vars && return - [[ $SCM == $SCM_P4 ]] && p4_prompt_vars && return - [[ $SCM == $SCM_HG ]] && hg_prompt_vars && return - [[ $SCM == $SCM_SVN ]] && svn_prompt_vars && return + scm + scm_prompt_char + SCM_DIRTY=0 + SCM_STATE='' + [[ $SCM == $SCM_GIT ]] && git_prompt_vars && return + [[ $SCM == $SCM_P4 ]] && p4_prompt_vars && return + [[ $SCM == $SCM_HG ]] && hg_prompt_vars && return + [[ $SCM == $SCM_SVN ]] && svn_prompt_vars && return } function scm_prompt_info { - scm - scm_prompt_char - scm_prompt_info_common + scm + scm_prompt_char + scm_prompt_info_common } function scm_prompt_char_info { - scm_prompt_char - echo -ne "${SCM_THEME_CHAR_PREFIX}${SCM_CHAR}${SCM_THEME_CHAR_SUFFIX}" - scm_prompt_info_common + scm_prompt_char + echo -ne "${SCM_THEME_CHAR_PREFIX}${SCM_CHAR}${SCM_THEME_CHAR_SUFFIX}" + scm_prompt_info_common } function scm_prompt_info_common { - SCM_DIRTY=0 - SCM_STATE='' + SCM_DIRTY=0 + SCM_STATE='' - if [[ ${SCM} == ${SCM_GIT} ]]; then - if [[ ${SCM_GIT_SHOW_MINIMAL_INFO} == true ]]; then - # user requests minimal git status information - git_prompt_minimal_info - else - # more detailed git status - git_prompt_info - fi - return - fi + if [[ ${SCM} == ${SCM_GIT} ]]; then + if [[ ${SCM_GIT_SHOW_MINIMAL_INFO} == true ]]; then + # user requests minimal git status information + git_prompt_minimal_info + else + # more detailed git status + git_prompt_info + fi + return + fi - # TODO: consider adding minimal status information for hg and svn - { [[ ${SCM} == ${SCM_P4} ]] && p4_prompt_info && return; } || true - { [[ ${SCM} == ${SCM_HG} ]] && hg_prompt_info && return; } || true - { [[ ${SCM} == ${SCM_SVN} ]] && svn_prompt_info && return; } || true + # TODO: consider adding minimal status information for hg and svn + { [[ ${SCM} == ${SCM_P4} ]] && p4_prompt_info && return; } || true + { [[ ${SCM} == ${SCM_HG} ]] && hg_prompt_info && return; } || true + { [[ ${SCM} == ${SCM_SVN} ]] && svn_prompt_info && return; } || true } function terraform_workspace_prompt { - if _command_exists terraform ; then - if [ -d .terraform ]; then - echo -e "$(terraform workspace show 2>/dev/null)" - fi - fi + if _command_exists terraform; then + if [ -d .terraform ]; then + echo -e "$(terraform workspace show 2> /dev/null)" + fi + fi } function git_prompt_minimal_info { - SCM_STATE=${SCM_THEME_PROMPT_CLEAN} + SCM_STATE=${SCM_THEME_PROMPT_CLEAN} - _git-hide-status && return + _git-hide-status && return - SCM_BRANCH="${SCM_THEME_BRANCH_PREFIX}\$(_git-friendly-ref)" + SCM_BRANCH="${SCM_THEME_BRANCH_PREFIX}\$(_git-friendly-ref)" - if [[ -n "$(_git-status | tail -n1)" ]]; then - SCM_DIRTY=1 - SCM_STATE=${SCM_THEME_PROMPT_DIRTY} - fi + if [[ -n "$(_git-status | tail -n1)" ]]; then + SCM_DIRTY=1 + SCM_STATE=${SCM_THEME_PROMPT_DIRTY} + fi - # Output the git prompt - SCM_PREFIX=${SCM_THEME_PROMPT_PREFIX} - SCM_SUFFIX=${SCM_THEME_PROMPT_SUFFIX} - echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}" + # Output the git prompt + SCM_PREFIX=${SCM_THEME_PROMPT_PREFIX} + SCM_SUFFIX=${SCM_THEME_PROMPT_SUFFIX} + echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}" } function git_prompt_vars { - if ${SCM_GIT_USE_GITSTATUS} && _command_exists gitstatus_query && gitstatus_query && [[ "${VCS_STATUS_RESULT}" == "ok-sync" ]]; then # use faster gitstatus - SCM_GIT_GITSTATUS_RAN=true # use this in githelpers and below to choose gitstatus output - else - SCM_GIT_GITSTATUS_RAN=false - fi + if ${SCM_GIT_USE_GITSTATUS} && _command_exists gitstatus_query && gitstatus_query && [[ "${VCS_STATUS_RESULT}" == "ok-sync" ]]; then # use faster gitstatus + SCM_GIT_GITSTATUS_RAN=true # use this in githelpers and below to choose gitstatus output + else + SCM_GIT_GITSTATUS_RAN=false + fi - if _git-branch &> /dev/null; then - SCM_GIT_DETACHED="false" - SCM_BRANCH="${SCM_THEME_BRANCH_PREFIX}\$(_git-friendly-ref)$(_git-remote-info)" - else - SCM_GIT_DETACHED="true" + if _git-branch &> /dev/null; then + SCM_GIT_DETACHED="false" + SCM_BRANCH="${SCM_THEME_BRANCH_PREFIX}\$(_git-friendly-ref)$(_git-remote-info)" + else + SCM_GIT_DETACHED="true" - local detached_prefix - if _git-tag &> /dev/null; then - detached_prefix=${SCM_THEME_TAG_PREFIX} - else - detached_prefix=${SCM_THEME_DETACHED_PREFIX} - fi - SCM_BRANCH="${detached_prefix}\$(_git-friendly-ref)" - fi + local detached_prefix + if _git-tag &> /dev/null; then + detached_prefix=${SCM_THEME_TAG_PREFIX} + else + detached_prefix=${SCM_THEME_DETACHED_PREFIX} + fi + SCM_BRANCH="${detached_prefix}\$(_git-friendly-ref)" + fi - if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then - commits_behind=${VCS_STATUS_COMMITS_BEHIND} - commits_ahead=${VCS_STATUS_COMMITS_AHEAD} - else - IFS=$'\t' read -r commits_behind commits_ahead <<< "$(_git-upstream-behind-ahead)" - fi - if [[ "${commits_ahead}" -gt 0 ]]; then - SCM_BRANCH+="${SCM_GIT_AHEAD_BEHIND_PREFIX_CHAR}${SCM_GIT_AHEAD_CHAR}" - [[ "${SCM_GIT_SHOW_COMMIT_COUNT}" = "true" ]] && SCM_BRANCH+="${commits_ahead}" - fi - if [[ "${commits_behind}" -gt 0 ]]; then - SCM_BRANCH+="${SCM_GIT_AHEAD_BEHIND_PREFIX_CHAR}${SCM_GIT_BEHIND_CHAR}" - [[ "${SCM_GIT_SHOW_COMMIT_COUNT}" = "true" ]] && SCM_BRANCH+="${commits_behind}" - fi + if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then + commits_behind=${VCS_STATUS_COMMITS_BEHIND} + commits_ahead=${VCS_STATUS_COMMITS_AHEAD} + else + IFS=$'\t' read -r commits_behind commits_ahead <<< "$(_git-upstream-behind-ahead)" + fi + if [[ "${commits_ahead}" -gt 0 ]]; then + SCM_BRANCH+="${SCM_GIT_AHEAD_BEHIND_PREFIX_CHAR}${SCM_GIT_AHEAD_CHAR}" + [[ "${SCM_GIT_SHOW_COMMIT_COUNT}" = "true" ]] && SCM_BRANCH+="${commits_ahead}" + fi + if [[ "${commits_behind}" -gt 0 ]]; then + SCM_BRANCH+="${SCM_GIT_AHEAD_BEHIND_PREFIX_CHAR}${SCM_GIT_BEHIND_CHAR}" + [[ "${SCM_GIT_SHOW_COMMIT_COUNT}" = "true" ]] && SCM_BRANCH+="${commits_behind}" + fi - if [[ "${SCM_GIT_SHOW_STASH_INFO}" = "true" ]]; then - local stash_count - if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then - stash_count=${VCS_STATUS_STASHES} - else - stash_count="$(git stash list 2> /dev/null | wc -l | tr -d ' ')" - fi - [[ "${stash_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_STASH_CHAR_PREFIX}${stash_count}${SCM_GIT_STASH_CHAR_SUFFIX}" - fi + if [[ "${SCM_GIT_SHOW_STASH_INFO}" = "true" ]]; then + local stash_count + if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then + stash_count=${VCS_STATUS_STASHES} + else + stash_count="$(git stash list 2> /dev/null | wc -l | tr -d ' ')" + fi + [[ "${stash_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_STASH_CHAR_PREFIX}${stash_count}${SCM_GIT_STASH_CHAR_SUFFIX}" + fi - SCM_STATE=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} - if ! _git-hide-status; then - if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then - untracked_count=${VCS_STATUS_NUM_UNTRACKED} - unstaged_count=${VCS_STATUS_NUM_UNSTAGED} - staged_count=${VCS_STATUS_NUM_STAGED} - else - IFS=$'\t' read -r untracked_count unstaged_count staged_count <<< "$(_git-status-counts)" - fi - if [[ "${untracked_count}" -gt 0 || "${unstaged_count}" -gt 0 || "${staged_count}" -gt 0 ]]; then - SCM_DIRTY=1 - if [[ "${SCM_GIT_SHOW_DETAILS}" = "true" ]]; then - [[ "${staged_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_STAGED_CHAR}${staged_count}" && SCM_DIRTY=3 - [[ "${unstaged_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_UNSTAGED_CHAR}${unstaged_count}" && SCM_DIRTY=2 - [[ "${untracked_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_UNTRACKED_CHAR}${untracked_count}" && SCM_DIRTY=1 - fi - SCM_STATE=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} - fi - fi + SCM_STATE=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + if ! _git-hide-status; then + if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then + untracked_count=${VCS_STATUS_NUM_UNTRACKED} + unstaged_count=${VCS_STATUS_NUM_UNSTAGED} + staged_count=${VCS_STATUS_NUM_STAGED} + else + IFS=$'\t' read -r untracked_count unstaged_count staged_count <<< "$(_git-status-counts)" + fi + if [[ "${untracked_count}" -gt 0 || "${unstaged_count}" -gt 0 || "${staged_count}" -gt 0 ]]; then + SCM_DIRTY=1 + if [[ "${SCM_GIT_SHOW_DETAILS}" = "true" ]]; then + [[ "${staged_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_STAGED_CHAR}${staged_count}" && SCM_DIRTY=3 + [[ "${unstaged_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_UNSTAGED_CHAR}${unstaged_count}" && SCM_DIRTY=2 + [[ "${untracked_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_UNTRACKED_CHAR}${untracked_count}" && SCM_DIRTY=1 + fi + SCM_STATE=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + fi + fi - # no if for gitstatus here, user extraction is not supported by it - [[ "${SCM_GIT_SHOW_CURRENT_USER}" == "true" ]] && SCM_BRANCH+="$(git_user_info)" + # no if for gitstatus here, user extraction is not supported by it + [[ "${SCM_GIT_SHOW_CURRENT_USER}" == "true" ]] && SCM_BRANCH+="$(git_user_info)" - SCM_PREFIX=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} - SCM_SUFFIX=${GIT_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} + SCM_PREFIX=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} + SCM_SUFFIX=${GIT_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} - SCM_CHANGE=$(_git-short-sha 2>/dev/null || echo "") + SCM_CHANGE=$(_git-short-sha 2> /dev/null || echo "") } function p4_prompt_vars { - IFS=$'\t' read -r \ - opened_count non_default_changes default_count \ - add_file_count edit_file_count delete_file_count \ - <<< "$(_p4-opened-counts)" - if [[ "${opened_count}" -gt 0 ]]; then - SCM_DIRTY=1 - SCM_STATE=${SCM_THEME_PROMPT_DIRTY} - [[ "${opened_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_P4_OPENED_CHAR}${opened_count}" - [[ "${non_default_changes}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_P4_CHANGES_CHAR}${non_default_changes}" - [[ "${default_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_P4_DEFAULT_CHAR}${default_count}" - else - SCM_DIRTY=0 - SCM_STATE=${SCM_THEME_PROMPT_DIRTY} - fi + IFS=$'\t' read -r \ + opened_count non_default_changes default_count \ + add_file_count edit_file_count delete_file_count \ + <<< "$(_p4-opened-counts)" + if [[ "${opened_count}" -gt 0 ]]; then + SCM_DIRTY=1 + SCM_STATE=${SCM_THEME_PROMPT_DIRTY} + [[ "${opened_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_P4_OPENED_CHAR}${opened_count}" + [[ "${non_default_changes}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_P4_CHANGES_CHAR}${non_default_changes}" + [[ "${default_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_P4_DEFAULT_CHAR}${default_count}" + else + SCM_DIRTY=0 + SCM_STATE=${SCM_THEME_PROMPT_DIRTY} + fi - SCM_PREFIX=${P4_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} - SCM_SUFFIX=${P4_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} + SCM_PREFIX=${P4_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} + SCM_SUFFIX=${P4_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} } function svn_prompt_vars { - if [[ -n $(svn status |head -c1 2> /dev/null) ]]; then - SCM_DIRTY=1 - SCM_STATE=${SVN_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} - else - SCM_DIRTY=0 - SCM_STATE=${SVN_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} - 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 --show-item=url 2> /dev/null | awk -F/ '{ 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 --show-item=revision 2> /dev/null) + if [[ -n $(svn status | head -c1 2> /dev/null) ]]; then + SCM_DIRTY=1 + SCM_STATE=${SVN_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + else + SCM_DIRTY=0 + SCM_STATE=${SVN_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + 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 --show-item=url 2> /dev/null | awk -F/ '{ 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 --show-item=revision 2> /dev/null) } # this functions returns absolute location of .hg directory if one exists @@ -310,268 +324,268 @@ function svn_prompt_vars { # - .hg is located in ~/Projects/Foo/.hg # - get_hg_root starts at ~/Projects/Foo/Bar and sees that there is no .hg directory, so then it goes into ~/Projects/Foo function get_hg_root { - local CURRENT_DIR=$(pwd) + local CURRENT_DIR=$(pwd) - while [ "$CURRENT_DIR" != "/" ]; do - if [ -d "$CURRENT_DIR/.hg" ]; then - echo "$CURRENT_DIR/.hg" - return - fi + while [ "$CURRENT_DIR" != "/" ]; do + if [ -d "$CURRENT_DIR/.hg" ]; then + echo "$CURRENT_DIR/.hg" + return + fi - CURRENT_DIR=$(dirname $CURRENT_DIR) - done + CURRENT_DIR=$(dirname $CURRENT_DIR) + done } function hg_prompt_vars { - if [[ -n $(hg status 2> /dev/null) ]]; then - SCM_DIRTY=1 - SCM_STATE=${HG_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} - else - SCM_DIRTY=0 - SCM_STATE=${HG_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} - fi - SCM_PREFIX=${HG_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} - SCM_SUFFIX=${HG_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} + if [[ -n $(hg status 2> /dev/null) ]]; then + SCM_DIRTY=1 + SCM_STATE=${HG_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + else + SCM_DIRTY=0 + SCM_STATE=${HG_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + fi + SCM_PREFIX=${HG_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} + SCM_SUFFIX=${HG_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} - HG_ROOT=$(get_hg_root) + HG_ROOT=$(get_hg_root) - if [ -f "$HG_ROOT/branch" ]; then - # Mercurial holds it's current branch in .hg/branch file - SCM_BRANCH=$(cat "$HG_ROOT/branch") - else - SCM_BRANCH=$(hg summary 2> /dev/null | grep branch: | awk '{print $2}') - fi + if [ -f "$HG_ROOT/branch" ]; then + # Mercurial holds it's current branch in .hg/branch file + SCM_BRANCH=$(cat "$HG_ROOT/branch") + else + SCM_BRANCH=$(hg summary 2> /dev/null | grep branch: | awk '{print $2}') + fi - if [ -f "$HG_ROOT/dirstate" ]; then - # Mercurial holds various information about the working directory in .hg/dirstate file. More on http://mercurial.selenic.com/wiki/DirState - SCM_CHANGE=$(hexdump -vn 10 -e '1/1 "%02x"' "$HG_ROOT/dirstate" | cut -c-12) - else - SCM_CHANGE=$(hg summary 2> /dev/null | grep parent: | awk '{print $2}') - fi + if [ -f "$HG_ROOT/dirstate" ]; then + # Mercurial holds various information about the working directory in .hg/dirstate file. More on http://mercurial.selenic.com/wiki/DirState + SCM_CHANGE=$(hexdump -vn 10 -e '1/1 "%02x"' "$HG_ROOT/dirstate" | cut -c-12) + else + SCM_CHANGE=$(hg summary 2> /dev/null | grep parent: | awk '{print $2}') + fi } function nvm_version_prompt { - local node - if declare -f -F nvm &> /dev/null; then - node=$(nvm current 2> /dev/null) - [[ "${node}" == "system" ]] && return - echo -e "${NVM_THEME_PROMPT_PREFIX}${node}${NVM_THEME_PROMPT_SUFFIX}" - fi + local node + if declare -f -F nvm &> /dev/null; then + node=$(nvm current 2> /dev/null) + [[ "${node}" == "system" ]] && return + echo -e "${NVM_THEME_PROMPT_PREFIX}${node}${NVM_THEME_PROMPT_SUFFIX}" + fi } function node_version_prompt { - echo -e "$(nvm_version_prompt)" + echo -e "$(nvm_version_prompt)" } function rvm_version_prompt { - if which rvm &> /dev/null; then - rvm=$(rvm-prompt) || return - if [ -n "$rvm" ]; then - echo -e "$RVM_THEME_PROMPT_PREFIX$rvm$RVM_THEME_PROMPT_SUFFIX" - fi - fi + if which rvm &> /dev/null; then + rvm=$(rvm-prompt) || return + if [ -n "$rvm" ]; then + echo -e "$RVM_THEME_PROMPT_PREFIX$rvm$RVM_THEME_PROMPT_SUFFIX" + fi + fi } function rbenv_version_prompt { - if which rbenv &> /dev/null; then - rbenv=$(rbenv version-name) || return - $(rbenv commands | grep -q gemset) && gemset=$(rbenv gemset active 2> /dev/null) && rbenv="$rbenv@${gemset%% *}" - if [ $rbenv != "system" ]; then - echo -e "$RBENV_THEME_PROMPT_PREFIX$rbenv$RBENV_THEME_PROMPT_SUFFIX" - fi - fi + if which rbenv &> /dev/null; then + rbenv=$(rbenv version-name) || return + $(rbenv commands | grep -q gemset) && gemset=$(rbenv gemset active 2> /dev/null) && rbenv="$rbenv@${gemset%% *}" + if [ $rbenv != "system" ]; then + echo -e "$RBENV_THEME_PROMPT_PREFIX$rbenv$RBENV_THEME_PROMPT_SUFFIX" + fi + fi } function rbfu_version_prompt { - if [[ $RBFU_RUBY_VERSION ]]; then - echo -e "${RBFU_THEME_PROMPT_PREFIX}${RBFU_RUBY_VERSION}${RBFU_THEME_PROMPT_SUFFIX}" - fi + if [[ $RBFU_RUBY_VERSION ]]; then + echo -e "${RBFU_THEME_PROMPT_PREFIX}${RBFU_RUBY_VERSION}${RBFU_THEME_PROMPT_SUFFIX}" + fi } function chruby_version_prompt { - if declare -f -F chruby &> /dev/null; then - if declare -f -F chruby_auto &> /dev/null; then - chruby_auto - fi + if declare -f -F chruby &> /dev/null; then + if declare -f -F chruby_auto &> /dev/null; then + chruby_auto + fi - ruby_version=$(ruby --version | awk '{print $1, $2;}') || return + ruby_version=$(ruby --version | awk '{print $1, $2;}') || return - if [[ ! $(chruby | grep '\*') ]]; then - ruby_version="${ruby_version} (system)" - fi - echo -e "${CHRUBY_THEME_PROMPT_PREFIX}${ruby_version}${CHRUBY_THEME_PROMPT_SUFFIX}" - fi + if [[ ! $(chruby | grep '\*') ]]; then + ruby_version="${ruby_version} (system)" + fi + echo -e "${CHRUBY_THEME_PROMPT_PREFIX}${ruby_version}${CHRUBY_THEME_PROMPT_SUFFIX}" + fi } function ruby_version_prompt { - if [[ "${THEME_SHOW_RUBY_PROMPT}" = "true" ]]; then - echo -e "$(rbfu_version_prompt)$(rbenv_version_prompt)$(rvm_version_prompt)$(chruby_version_prompt)" - fi + if [[ "${THEME_SHOW_RUBY_PROMPT}" = "true" ]]; then + echo -e "$(rbfu_version_prompt)$(rbenv_version_prompt)$(rvm_version_prompt)$(chruby_version_prompt)" + fi } function k8s_context_prompt { - echo -e "$(kubectl config current-context 2> /dev/null)" + echo -e "$(kubectl config current-context 2> /dev/null)" } function virtualenv_prompt { - if [[ -n "$VIRTUAL_ENV" ]]; then - virtualenv=`basename "$VIRTUAL_ENV"` - echo -e "$VIRTUALENV_THEME_PROMPT_PREFIX$virtualenv$VIRTUALENV_THEME_PROMPT_SUFFIX" - fi + if [[ -n "$VIRTUAL_ENV" ]]; then + virtualenv=$(basename "$VIRTUAL_ENV") + echo -e "$VIRTUALENV_THEME_PROMPT_PREFIX$virtualenv$VIRTUALENV_THEME_PROMPT_SUFFIX" + fi } function condaenv_prompt { - if [[ $CONDA_DEFAULT_ENV ]]; then - echo -e "${CONDAENV_THEME_PROMPT_PREFIX}${CONDA_DEFAULT_ENV}${CONDAENV_THEME_PROMPT_SUFFIX}" - fi + if [[ $CONDA_DEFAULT_ENV ]]; then + echo -e "${CONDAENV_THEME_PROMPT_PREFIX}${CONDA_DEFAULT_ENV}${CONDAENV_THEME_PROMPT_SUFFIX}" + fi } function py_interp_prompt { - py_version=$(python --version 2>&1 | awk 'NR==1{print "py-"$2;}') || return - echo -e "${PYTHON_THEME_PROMPT_PREFIX}${py_version}${PYTHON_THEME_PROMPT_SUFFIX}" + py_version=$(python --version 2>&1 | awk 'NR==1{print "py-"$2;}') || return + echo -e "${PYTHON_THEME_PROMPT_PREFIX}${py_version}${PYTHON_THEME_PROMPT_SUFFIX}" } function python_version_prompt { - echo -e "$(virtualenv_prompt)$(condaenv_prompt)$(py_interp_prompt)" + echo -e "$(virtualenv_prompt)$(condaenv_prompt)$(py_interp_prompt)" } function git_user_info { - # support two or more initials, set by 'git pair' plugin - SCM_CURRENT_USER=$(git config user.initials | sed 's% %+%') - # if `user.initials` weren't set, attempt to extract initials from `user.name` - [[ -z "${SCM_CURRENT_USER}" ]] && SCM_CURRENT_USER=$(printf "%s" $(for word in $(git config user.name | PERLIO=:utf8 perl -pe '$_=lc'); do printf "%s" "${word:0:1}"; done)) - [[ -n "${SCM_CURRENT_USER}" ]] && printf "%s" "$SCM_THEME_CURRENT_USER_PREFFIX$SCM_CURRENT_USER$SCM_THEME_CURRENT_USER_SUFFIX" + # support two or more initials, set by 'git pair' plugin + SCM_CURRENT_USER=$(git config user.initials | sed 's% %+%') + # if `user.initials` weren't set, attempt to extract initials from `user.name` + [[ -z "${SCM_CURRENT_USER}" ]] && SCM_CURRENT_USER=$(printf "%s" $(for word in $(git config user.name | PERLIO=:utf8 perl -pe '$_=lc'); do printf "%s" "${word:0:1}"; done)) + [[ -n "${SCM_CURRENT_USER}" ]] && printf "%s" "$SCM_THEME_CURRENT_USER_PREFFIX$SCM_CURRENT_USER$SCM_THEME_CURRENT_USER_SUFFIX" } function clock_char { - CLOCK_CHAR=${THEME_CLOCK_CHAR:-"⌚"} - CLOCK_CHAR_COLOR=${THEME_CLOCK_CHAR_COLOR:-"$normal"} - SHOW_CLOCK_CHAR=${THEME_SHOW_CLOCK_CHAR:-"true"} + CLOCK_CHAR=${THEME_CLOCK_CHAR:-"⌚"} + CLOCK_CHAR_COLOR=${THEME_CLOCK_CHAR_COLOR:-"$normal"} + SHOW_CLOCK_CHAR=${THEME_SHOW_CLOCK_CHAR:-"true"} - if [[ "${SHOW_CLOCK_CHAR}" = "true" ]]; then - echo -e "${CLOCK_CHAR_COLOR}${CLOCK_CHAR_THEME_PROMPT_PREFIX}${CLOCK_CHAR}${CLOCK_CHAR_THEME_PROMPT_SUFFIX}" - fi + if [[ "${SHOW_CLOCK_CHAR}" = "true" ]]; then + echo -e "${CLOCK_CHAR_COLOR}${CLOCK_CHAR_THEME_PROMPT_PREFIX}${CLOCK_CHAR}${CLOCK_CHAR_THEME_PROMPT_SUFFIX}" + fi } function clock_prompt { - CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$normal"} - CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%H:%M:%S"} - [ -z $THEME_SHOW_CLOCK ] && THEME_SHOW_CLOCK=${THEME_CLOCK_CHECK:-"true"} - SHOW_CLOCK=$THEME_SHOW_CLOCK + CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$normal"} + CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%H:%M:%S"} + [ -z $THEME_SHOW_CLOCK ] && THEME_SHOW_CLOCK=${THEME_CLOCK_CHECK:-"true"} + SHOW_CLOCK=$THEME_SHOW_CLOCK - if [[ "${SHOW_CLOCK}" = "true" ]]; then - CLOCK_STRING=$(date +"${CLOCK_FORMAT}") - echo -e "${CLOCK_COLOR}${CLOCK_THEME_PROMPT_PREFIX}${CLOCK_STRING}${CLOCK_THEME_PROMPT_SUFFIX}" - fi + if [[ "${SHOW_CLOCK}" = "true" ]]; then + CLOCK_STRING=$(date +"${CLOCK_FORMAT}") + echo -e "${CLOCK_COLOR}${CLOCK_THEME_PROMPT_PREFIX}${CLOCK_STRING}${CLOCK_THEME_PROMPT_SUFFIX}" + fi } function user_host_prompt { - if [[ "${THEME_SHOW_USER_HOST}" = "true" ]]; then - echo -e "${USER_HOST_THEME_PROMPT_PREFIX}\u@\h${USER_HOST_THEME_PROMPT_SUFFIX}" - fi + if [[ "${THEME_SHOW_USER_HOST}" = "true" ]]; then + echo -e "${USER_HOST_THEME_PROMPT_PREFIX}\u@\h${USER_HOST_THEME_PROMPT_SUFFIX}" + fi } # backwards-compatibility function git_prompt_info { - _git-hide-status && return - git_prompt_vars - echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}" + _git-hide-status && return + git_prompt_vars + echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}" } function p4_prompt_info() { - p4_prompt_vars - echo -e "${SCM_PREFIX}${SCM_BRANCH}:${SCM_CHANGE}${SCM_STATE}${SCM_SUFFIX}" + p4_prompt_vars + echo -e "${SCM_PREFIX}${SCM_BRANCH}:${SCM_CHANGE}${SCM_STATE}${SCM_SUFFIX}" } function svn_prompt_info { - svn_prompt_vars - echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}" + svn_prompt_vars + echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}" } function hg_prompt_info() { - hg_prompt_vars - echo -e "${SCM_PREFIX}${SCM_BRANCH}:${SCM_CHANGE#*:}${SCM_STATE}${SCM_SUFFIX}" + hg_prompt_vars + echo -e "${SCM_PREFIX}${SCM_BRANCH}:${SCM_CHANGE#*:}${SCM_STATE}${SCM_SUFFIX}" } function scm_char { - scm_prompt_char - echo -e "${SCM_THEME_CHAR_PREFIX}${SCM_CHAR}${SCM_THEME_CHAR_SUFFIX}" + scm_prompt_char + echo -e "${SCM_THEME_CHAR_PREFIX}${SCM_CHAR}${SCM_THEME_CHAR_SUFFIX}" } function prompt_char { - scm_char + scm_char } function battery_char { - if [[ "${THEME_BATTERY_PERCENTAGE_CHECK}" = true ]]; then - echo -e "${bold_red}$(battery_percentage)%" - fi + if [[ "${THEME_BATTERY_PERCENTAGE_CHECK}" = true ]]; then + echo -e "${bold_red}$(battery_percentage)%" + fi } -if ! _command_exists battery_charge ; then - # if user has installed battery plugin, skip this... - function battery_charge (){ - # no op - echo -n - } +if ! _command_exists battery_charge; then + # if user has installed battery plugin, skip this... + function battery_charge() { + # no op + echo -n + } fi # The battery_char function depends on the presence of the battery_percentage function. # If battery_percentage is not defined, then define battery_char as a no-op. -if ! _command_exists battery_percentage ; then - function battery_char (){ - # no op - echo -n - } +if ! _command_exists battery_percentage; then + function battery_char() { + # no op + echo -n + } fi function aws_profile { - if [[ $AWS_DEFAULT_PROFILE ]]; then - echo -e "${AWS_DEFAULT_PROFILE}" - else - echo -e "default" - fi + if [[ $AWS_DEFAULT_PROFILE ]]; then + echo -e "${AWS_DEFAULT_PROFILE}" + else + echo -e "default" + fi } function __check_precmd_conflict() { - local f - for f in "${precmd_functions[@]}"; do - if [[ "${f}" == "${1}" ]]; then - return 0 - fi - done - return 1 + local f + for f in "${precmd_functions[@]}"; do + if [[ "${f}" == "${1}" ]]; then + return 0 + fi + done + return 1 } function safe_append_prompt_command { - local prompt_re + local prompt_re - if [ "${__bp_imported}" == "defined" ]; then - # We are using bash-preexec - if ! __check_precmd_conflict "${1}" ; then - precmd_functions+=("${1}") - fi - else - # Set OS dependent exact match regular expression - if [[ ${OSTYPE} == darwin* ]]; then - # macOS - prompt_re="[[:<:]]${1}[[:>:]]" - else - # Linux, FreeBSD, etc. - prompt_re="\<${1}\>" - fi + if [ "${__bp_imported}" == "defined" ]; then + # We are using bash-preexec + if ! __check_precmd_conflict "${1}"; then + precmd_functions+=("${1}") + fi + else + # Set OS dependent exact match regular expression + if [[ ${OSTYPE} == darwin* ]]; then + # macOS + prompt_re="[[:<:]]${1}[[:>:]]" + else + # Linux, FreeBSD, etc. + prompt_re="\<${1}\>" + fi - if [[ ${PROMPT_COMMAND} =~ ${prompt_re} ]]; then - return - elif [[ -z ${PROMPT_COMMAND} ]]; then - PROMPT_COMMAND="${1}" - else - PROMPT_COMMAND="${1};${PROMPT_COMMAND}" - fi - fi + if [[ ${PROMPT_COMMAND} =~ ${prompt_re} ]]; then + return + elif [[ -z ${PROMPT_COMMAND} ]]; then + PROMPT_COMMAND="${1}" + else + PROMPT_COMMAND="${1};${PROMPT_COMMAND}" + fi + fi } function _save-and-reload-history() { - local autosave=${1:-0} - [[ $autosave -eq 1 ]] && history -a && history -c && history -r + local autosave=${1:-0} + [[ $autosave -eq 1 ]] && history -a && history -c && history -r } From 94d261b42d1ed307286b2bce86aff9e732a85158 Mon Sep 17 00:00:00 2001 From: Marcos Pereira Date: Mon, 11 Jan 2021 15:34:18 -0500 Subject: [PATCH 05/10] Fix shellcheck warnings for themes/base.theme.bash --- themes/base.theme.bash | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 0382a6af..c7613913 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +# shellcheck shell=bash CLOCK_CHAR_THEME_PROMPT_PREFIX='' CLOCK_CHAR_THEME_PROMPT_SUFFIX='' @@ -123,13 +123,13 @@ function scm { function scm_prompt_char { if [[ -z $SCM ]]; then scm; fi - if [[ $SCM == $SCM_GIT ]]; then + if [[ $SCM == "$SCM_GIT" ]]; then SCM_CHAR=$SCM_GIT_CHAR - elif [[ $SCM == $SCM_P4 ]]; then + elif [[ $SCM == "$SCM_P4" ]]; then SCM_CHAR=$SCM_P4_CHAR - elif [[ $SCM == $SCM_HG ]]; then + elif [[ $SCM == "$SCM_HG" ]]; then SCM_CHAR=$SCM_HG_CHAR - elif [[ $SCM == $SCM_SVN ]]; then + elif [[ $SCM == "$SCM_SVN" ]]; then SCM_CHAR=$SCM_SVN_CHAR else SCM_CHAR=$SCM_NONE_CHAR @@ -141,10 +141,10 @@ function scm_prompt_vars { scm_prompt_char SCM_DIRTY=0 SCM_STATE='' - [[ $SCM == $SCM_GIT ]] && git_prompt_vars && return - [[ $SCM == $SCM_P4 ]] && p4_prompt_vars && return - [[ $SCM == $SCM_HG ]] && hg_prompt_vars && return - [[ $SCM == $SCM_SVN ]] && svn_prompt_vars && return + [[ $SCM == "$SCM_GIT" ]] && git_prompt_vars && return + [[ $SCM == "$SCM_P4" ]] && p4_prompt_vars && return + [[ $SCM == "$SCM_HG" ]] && hg_prompt_vars && return + [[ $SCM == "$SCM_SVN" ]] && svn_prompt_vars && return } function scm_prompt_info { @@ -163,7 +163,7 @@ function scm_prompt_info_common { SCM_DIRTY=0 SCM_STATE='' - if [[ ${SCM} == ${SCM_GIT} ]]; then + if [[ ${SCM} == "${SCM_GIT}" ]]; then if [[ ${SCM_GIT_SHOW_MINIMAL_INFO} == true ]]; then # user requests minimal git status information git_prompt_minimal_info @@ -175,9 +175,9 @@ function scm_prompt_info_common { fi # TODO: consider adding minimal status information for hg and svn - { [[ ${SCM} == ${SCM_P4} ]] && p4_prompt_info && return; } || true - { [[ ${SCM} == ${SCM_HG} ]] && hg_prompt_info && return; } || true - { [[ ${SCM} == ${SCM_SVN} ]] && svn_prompt_info && return; } || true + { [[ ${SCM} == "${SCM_P4}" ]] && p4_prompt_info && return; } || true + { [[ ${SCM} == "${SCM_HG}" ]] && hg_prompt_info && return; } || true + { [[ ${SCM} == "${SCM_SVN}" ]] && svn_prompt_info && return; } || true } function terraform_workspace_prompt { @@ -332,7 +332,7 @@ function get_hg_root { return fi - CURRENT_DIR=$(dirname $CURRENT_DIR) + CURRENT_DIR=$(dirname "$CURRENT_DIR") done } @@ -389,8 +389,8 @@ function rvm_version_prompt { function rbenv_version_prompt { if which rbenv &> /dev/null; then rbenv=$(rbenv version-name) || return - $(rbenv commands | grep -q gemset) && gemset=$(rbenv gemset active 2> /dev/null) && rbenv="$rbenv@${gemset%% *}" - if [ $rbenv != "system" ]; then + $rbenv commands | grep -q gemset && gemset=$(rbenv gemset active 2> /dev/null) && rbenv="$rbenv@${gemset%% *}" + if [ "$rbenv" != "system" ]; then echo -e "$RBENV_THEME_PROMPT_PREFIX$rbenv$RBENV_THEME_PROMPT_SUFFIX" fi fi @@ -410,7 +410,7 @@ function chruby_version_prompt { ruby_version=$(ruby --version | awk '{print $1, $2;}') || return - if [[ ! $(chruby | grep '\*') ]]; then + if ! chruby | grep -q '\*'; then ruby_version="${ruby_version} (system)" fi echo -e "${CHRUBY_THEME_PROMPT_PREFIX}${ruby_version}${CHRUBY_THEME_PROMPT_SUFFIX}" @@ -453,7 +453,7 @@ function git_user_info { # support two or more initials, set by 'git pair' plugin SCM_CURRENT_USER=$(git config user.initials | sed 's% %+%') # if `user.initials` weren't set, attempt to extract initials from `user.name` - [[ -z "${SCM_CURRENT_USER}" ]] && SCM_CURRENT_USER=$(printf "%s" $(for word in $(git config user.name | PERLIO=:utf8 perl -pe '$_=lc'); do printf "%s" "${word:0:1}"; done)) + [[ -z "${SCM_CURRENT_USER}" ]] && SCM_CURRENT_USER=$(printf "%s" "$(for word in $(git config user.name | PERLIO=:utf8 perl -pe '$_=lc'); do printf "%s" "${word:0:1}"; done)") [[ -n "${SCM_CURRENT_USER}" ]] && printf "%s" "$SCM_THEME_CURRENT_USER_PREFFIX$SCM_CURRENT_USER$SCM_THEME_CURRENT_USER_SUFFIX" } @@ -470,7 +470,7 @@ function clock_char { function clock_prompt { CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$normal"} CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%H:%M:%S"} - [ -z $THEME_SHOW_CLOCK ] && THEME_SHOW_CLOCK=${THEME_CLOCK_CHECK:-"true"} + [ -z "$THEME_SHOW_CLOCK" ] && THEME_SHOW_CLOCK=${THEME_CLOCK_CHECK:-"true"} SHOW_CLOCK=$THEME_SHOW_CLOCK if [[ "${SHOW_CLOCK}" = "true" ]]; then From 436381de935daa0db2c5b4d010bfa8366b9f39e8 Mon Sep 17 00:00:00 2001 From: Ron Green <11993626+georgettica@users.noreply.github.com> Date: Wed, 16 Dec 2020 16:56:59 +0200 Subject: [PATCH 06/10] refactor(aliases): sort git aliases file and lint it - move all comments to the same line so they wont be jumbled - also add to clean_files.txt --- aliases/available/git.aliases.bash | 297 +++++++++++++++++------------ clean_files.txt | 2 + 2 files changed, 174 insertions(+), 125 deletions(-) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index a46b44fa..c2fa0d67 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -1,137 +1,184 @@ cite 'about-alias' about-alias 'common git abbreviations' -# Aliases -alias gcl='git clone' -alias ga='git add' -alias grm='git rm' -alias gap='git add -p' -alias gall='git add -A' -alias gf='git fetch --all --prune' -alias gft='git fetch --all --prune --tags' -alias gfv='git fetch --all --prune --verbose' -alias gftv='git fetch --all --prune --tags --verbose' -alias gus='git reset HEAD' -alias gpristine='git reset --hard && git clean -dfx' -alias gclean='git clean -fd' -alias gm="git merge" -alias gmv='git mv' alias g='git' -alias get='git' -alias gs='git status' -alias gss='git status -s' -alias gsu='git submodule update --init --recursive' -alias gl='git pull' -alias gpl='git pull' -alias glum='git pull upstream master' -alias gpr='git pull --rebase' -alias gpp='git pull && git push' -alias gup='git fetch && git rebase' -alias gp='git push' -alias gpd='git push --delete' -alias gpo='git push origin HEAD' -alias gpu='git push --set-upstream' -alias gpuo='git push --set-upstream origin' -alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)' -alias gpom='git push origin master' -alias gr='git remote' -alias grv='git remote -v' -alias gra='git remote add' -alias grb='git rebase' -alias grm='git rebase master' -alias grmi='git rebase master -i' + +# add +alias ga='git add' +alias gall='git add -A' +alias gap='git add -p' + +# branch +alias gb='git branch' +alias gbD='git branch -D' +alias gba='git branch -a' +alias gbd='git branch -d' +alias gbm='git branch -m' +alias gbt='git branch --track' +alias gdel='git branch -D' + +# odds and ends +alias gbc='git for-each-ref --format="%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)" refs/remotes/ --sort=authorname DESC' # FROM https://stackoverflow.com/a/58623139/10362396 + +# commit +alias gc='git commit -v' +alias gca='git commit -v -a' +alias gcaa='git commit -a --amend -C HEAD' # Add uncommitted and unstaged changes to the last commit +alias gcam='git commit -v -am' +alias gcamd='git commit --amend' +alias gcm='git commit -v -m' +alias gci='git commit --interactive' +alias gcsam='git commit -S -am' + +# checkout +alias gcb='git checkout -b' +alias gco='git checkout' +alias gcob='git checkout -b' +alias gcobu='git checkout -b ${USER}/' +alias gcom='git checkout master' +alias gcpd='git checkout master; git pull; git branch -D' +alias gct='git checkout --track' + +# odds and ends +alias gcl='git clone' +alias gclean='git clean -fd' +alias gcount='git shortlog -sn' + +# cherry-pick +alias gcp='git cherry-pick' +alias gcpx='git cherry-pick -x' + +# diff alias gd='git diff' alias gds='git diff --staged' alias gdt='git difftool' -alias gdv='git diff -w "$@" | vim -R -' -alias gc='git commit -v' -alias gca='git commit -v -a' -alias gcm='git commit -v -m' -alias gcam="git commit -v -am" -alias gci='git commit --interactive' -alias gcamd='git commit --amend' -alias gb='git branch' -alias gba='git branch -a' -# FROM https://stackoverflow.com/a/58623139/10362396 -alias gbc='git for-each-ref --format="%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)" refs/remotes/ --sort=authorname DESC' -alias gbt='git branch --track' -alias gbm='git branch -m' -alias gbd='git branch -d' -alias gbD='git branch -D' -alias gcount='git shortlog -sn' -alias gcp='git cherry-pick' -alias gcpx='git cherry-pick -x' -alias gco='git checkout' -alias gcom='git checkout master' -alias gcb='git checkout -b' -alias gcob='git checkout -b' -alias gcobu='git checkout -b ${USER}/' -alias gct='git checkout --track' -alias gcpd='git checkout master; git pull; git branch -D' -alias gexport='git archive --format zip --output' -alias gdel='git branch -D' -alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master' -alias gll='git log --graph --pretty=oneline --abbrev-commit' -alias gg="git log --graph --pretty=format:'%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset' --abbrev-commit --date=relative" -alias ggf="git log --graph --date=short --pretty=format:'%C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s'" -alias ggs="gg --stat" -alias gsh="git show" -alias gsl="git shortlog -sn" -alias gwc="git whatchanged" -alias gt="git tag" -alias gta="git tag -a" -alias gtd="git tag -d" -alias gtl="git tag -l" -alias gpatch="git format-patch -1" -# From http://blogs.atlassian.com/2014/10/advanced-git-aliases/ -# Show commits since last pull -alias gnew="git log HEAD@{1}..HEAD@{0}" -# Add uncommitted and unstaged changes to the last commit -alias gcaa="git commit -a --amend -C HEAD" -# Rebase with latest remote master -alias gprom="git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master" -alias gpf="git push --force" -alias gpunch="git push --force-with-lease" -alias ggui="git gui" -alias gcsam="git commit -S -am" -# Stash aliases -alias gst="git stash" -alias gstb="git stash branch" -alias gstd="git stash drop" -alias gstl="git stash list" -# Push introduced in git v2.13.2 -alias gstpu="git stash push" -alias gstpum="git stash push -m" -# Save deprecated since git v2.16.0 -# - aliases now resolve to push -alias gsts="git stash push" -alias gstsm="git stash push -m" -# Alias gstpo added for symmetry with gstpu (push) -# - gstp remains as alias for pop due to long-standing usage -alias gstpo="git stash pop" -alias gstp="git stash pop" -# Switch aliases - Requires git v2.23+ -alias gsw="git switch" -alias gswm="git switch master" -alias gswc="git switch --create" -alias gswt="git switch --track" -# Git home -alias ghm='cd "$(git rev-parse --show-toplevel)"' -if ! _command_exists gh; then - alias gh='ghm' -fi -# Show untracked files -alias gu='git ls-files . --exclude-standard --others' -# Git SVN -alias gsr='git svn rebase' +# Another Git alias +alias get='git' + +# odds and ends +alias gexport='git archive --format zip --output' + +# fetch +alias gf='git fetch --all --prune' +alias gft='git fetch --all --prune --tags' +alias gftv='git fetch --all --prune --tags --verbose' +alias gfv='git fetch --all --prune --verbose' +alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master' + +# log +alias gg='git log --graph --pretty=format:'\''%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset'\'' --abbrev-commit --date=relative' +alias ggf='git log --graph --date=short --pretty=format:'\''%C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s'\''' +alias ggs='gg --stat' +alias gll='git log --graph --pretty=oneline --abbrev-commit' +alias gnew='git log HEAD@{1}..HEAD@{0}' # Show commits since last pull, see http://blogs.atlassian.com/2014/10/advanced-git-aliases/ + +# odds and ends +alias ggui='git gui' +alias ghm='cd '\''$(git rev-parse --show-toplevel)'\''' # Git home +alias gm='git merge' +alias gmv='git mv' +alias gpatch='git format-patch -1' + +# push +alias gp='git push' +alias gpd='git push --delete' +alias gpf='git push --force' +alias gpo='git push origin HEAD' +alias gpom='git push origin master' +alias gpu='git push --set-upstream' +alias gpunch='git push --force-with-lease' +alias gpuo='git push --set-upstream origin' +alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)' + +# pull +alias gl='git pull' +alias glum='git pull upstream master' +alias gpl='git pull' +alias gpp='git pull && git push' +alias gpr='git pull --rebase' + +# odds and ends +alias gpristine='git reset --hard && git clean -dfx' +alias gprom='git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master' # Rebase with latest remote master + +# remote +alias gr='git remote' +alias gra='git remote add' +alias grv='git remote -v' + +# odds and ends +alias grm='git rm' + +# rebase +alias grb='git rebase' +alias grm='git rebase master' +alias grmi='git rebase master -i' + +# status +alias gs='git status' +alias gss='git status -s' + +# odds and ends alias gsd='git svn dcommit' +alias gsh='git show' +alias gsl='git shortlog -sn' +alias gsr='git svn rebase' # Git SVN + +# stash +alias gst='git stash' +alias gstb='git stash branch' +alias gstd='git stash drop' +alias gstl='git stash list' +alias gstp='git stash pop' # kept due to long-standing usage +alias gstpo='git stash pop' # recommended for it's symmetry with gstpu (push) + +## 'stash push' introduced in git v2.13.2 +alias gstpu='git stash push' +alias gstpum='git stash push -m' + +## 'stash save' deprecated since git v2.16.0, alias is now push +alias gsts='git stash push' +alias gstsm='git stash push -m' + +# odds and ends +alias gsu='git submodule update --init --recursive' + +# switch +# these aliases requires git v2.23+ +alias gsw='git switch' +alias gswc='git switch --create' +alias gswm='git switch master' +alias gswt='git switch --track' + +# tag +alias gt='git tag' +alias gta='git tag -a' +alias gtd='git tag -d' +alias gtl='git tag -l' + +# odds and ends +alias gu='git ls-files . --exclude-standard --others' # Show untracked files +alias gup='git fetch && git rebase' +alias gus='git reset HEAD' +alias gwc='git whatchanged' + +# appendage to ghm +# it's here as there is a command called gh on some machines +if ! _command_exists gh; then + alias gh='ghm' +fi case $OSTYPE in - darwin*) - alias gtls="git tag -l | gsort -V" - ;; - *) - alias gtls='git tag -l | sort -V' - ;; + darwin*) + alias gtls="git tag -l | gsort -V" + ;; + *) + alias gtls='git tag -l | sort -V' + ;; esac + +# functions +gdv() { + git diff --ignore-all-space "$@" | vim -R - +} diff --git a/clean_files.txt b/clean_files.txt index 85522112..4d7df5eb 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -46,5 +46,7 @@ completion/available/vault.completion.bash completion/available/sdkman.completion.bash # aliases +# aliases/available/dnf.aliases.bash aliases/available/vim.aliases.bash +aliases/available/git.aliases.bash From 8723fc56b2ea962880c81d78e09e87b38808633e Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Fri, 8 Jan 2021 23:43:00 +0200 Subject: [PATCH 07/10] aliases: git: Sort all commands, even miniscule ones --- aliases/available/git.aliases.bash | 70 +++++++++++++++++------------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index c2fa0d67..09c68d6d 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -2,6 +2,7 @@ cite 'about-alias' about-alias 'common git abbreviations' alias g='git' +alias get='git' # add alias ga='git add' @@ -17,7 +18,7 @@ alias gbm='git branch -m' alias gbt='git branch --track' alias gdel='git branch -D' -# odds and ends +# for-each-ref alias gbc='git for-each-ref --format="%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)" refs/remotes/ --sort=authorname DESC' # FROM https://stackoverflow.com/a/58623139/10362396 # commit @@ -39,10 +40,11 @@ alias gcom='git checkout master' alias gcpd='git checkout master; git pull; git branch -D' alias gct='git checkout --track' -# odds and ends +# clone alias gcl='git clone' + +# clean alias gclean='git clean -fd' -alias gcount='git shortlog -sn' # cherry-pick alias gcp='git cherry-pick' @@ -53,10 +55,7 @@ alias gd='git diff' alias gds='git diff --staged' alias gdt='git difftool' -# Another Git alias -alias get='git' - -# odds and ends +# archive alias gexport='git archive --format zip --output' # fetch @@ -65,6 +64,7 @@ alias gft='git fetch --all --prune --tags' alias gftv='git fetch --all --prune --tags --verbose' alias gfv='git fetch --all --prune --verbose' alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master' +alias gup='git fetch && git rebase' # log alias gg='git log --graph --pretty=format:'\''%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset'\'' --abbrev-commit --date=relative' @@ -72,12 +72,28 @@ alias ggf='git log --graph --date=short --pretty=format:'\''%C(auto)%h %Cgreen%a alias ggs='gg --stat' alias gll='git log --graph --pretty=oneline --abbrev-commit' alias gnew='git log HEAD@{1}..HEAD@{0}' # Show commits since last pull, see http://blogs.atlassian.com/2014/10/advanced-git-aliases/ +alias gwc='git whatchanged' -# odds and ends +# ls-files +alias gu='git ls-files . --exclude-standard --others' # Show untracked files + +# gui alias ggui='git gui' + +# home alias ghm='cd '\''$(git rev-parse --show-toplevel)'\''' # Git home +# appendage to ghm +if ! _command_exists gh; then + alias gh='ghm' +fi + +# merge alias gm='git merge' + +# mv alias gmv='git mv' + +# patch alias gpatch='git format-patch -1' # push @@ -98,31 +114,37 @@ alias gpl='git pull' alias gpp='git pull && git push' alias gpr='git pull --rebase' -# odds and ends -alias gpristine='git reset --hard && git clean -dfx' -alias gprom='git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master' # Rebase with latest remote master - # remote alias gr='git remote' alias gra='git remote add' alias grv='git remote -v' -# odds and ends +# rm alias grm='git rm' # rebase alias grb='git rebase' alias grm='git rebase master' alias grmi='git rebase master -i' +alias gprom='git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master' # Rebase with latest remote master + +# reset +alias gus='git reset HEAD' +alias gpristine='git reset --hard && git clean -dfx' # status alias gs='git status' alias gss='git status -s' -# odds and ends -alias gsd='git svn dcommit' -alias gsh='git show' +# shortlog +alias gcount='git shortlog -sn' alias gsl='git shortlog -sn' + +# show +alias gsh='git show' + +# svn +alias gsd='git svn dcommit' alias gsr='git svn rebase' # Git SVN # stash @@ -141,7 +163,7 @@ alias gstpum='git stash push -m' alias gsts='git stash push' alias gstsm='git stash push -m' -# odds and ends +# submodules alias gsu='git submodule update --init --recursive' # switch @@ -157,18 +179,6 @@ alias gta='git tag -a' alias gtd='git tag -d' alias gtl='git tag -l' -# odds and ends -alias gu='git ls-files . --exclude-standard --others' # Show untracked files -alias gup='git fetch && git rebase' -alias gus='git reset HEAD' -alias gwc='git whatchanged' - -# appendage to ghm -# it's here as there is a command called gh on some machines -if ! _command_exists gh; then - alias gh='ghm' -fi - case $OSTYPE in darwin*) alias gtls="git tag -l | gsort -V" @@ -179,6 +189,6 @@ case $OSTYPE in esac # functions -gdv() { +function gdv() { git diff --ignore-all-space "$@" | vim -R - } From dd4e410a324ebb861af1094d5748deca1137f458 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Wed, 13 Jan 2021 18:24:53 +0200 Subject: [PATCH 08/10] aliases: git: Add shellcheck header --- aliases/available/git.aliases.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index 09c68d6d..4f82ead0 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -1,3 +1,4 @@ +# shellcheck shell=bash cite 'about-alias' about-alias 'common git abbreviations' From 957cd578f76b482617891afd874bdc6388741beb Mon Sep 17 00:00:00 2001 From: Gurkirat Singh Date: Thu, 10 Dec 2020 09:27:42 +0530 Subject: [PATCH 09/10] Added git alias to list only conflicted files --- aliases/available/git.aliases.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index 4f82ead0..e14f9dbb 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -55,6 +55,7 @@ alias gcpx='git cherry-pick -x' alias gd='git diff' alias gds='git diff --staged' alias gdt='git difftool' +alias glsu='git diff --name-only --diff-filter=U' # lists only the names of conflicted files # archive alias gexport='git archive --format zip --output' From 610980dd231bb4ca0770c8013ec1a803ebdb8318 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Wed, 13 Jan 2021 21:19:55 +0200 Subject: [PATCH 10/10] git: aliases: Move glsu to glsum in ls-files and add glsut --- aliases/available/git.aliases.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index e14f9dbb..39d10c67 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -55,7 +55,6 @@ alias gcpx='git cherry-pick -x' alias gd='git diff' alias gds='git diff --staged' alias gdt='git difftool' -alias glsu='git diff --name-only --diff-filter=U' # lists only the names of conflicted files # archive alias gexport='git archive --format zip --output' @@ -78,6 +77,8 @@ alias gwc='git whatchanged' # ls-files alias gu='git ls-files . --exclude-standard --others' # Show untracked files +alias glsut='gu' +alias glsum='git diff --name-only --diff-filter=U' # Show unmerged (conflicted) files # gui alias ggui='git gui'