From 353cb210d4bf03db4ecb86985ca54cf3c643ee5c Mon Sep 17 00:00:00 2001 From: Shashank Bharadwaj Date: Wed, 14 Feb 2018 10:54:20 -0800 Subject: [PATCH 01/36] Add priliminary support for perforce SCM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds very simple support for the Perforce SCM: https://www.perforce.com/ Although perforce is proprietary software, it's somewhat prevalent in enterprise companies. This patch looks to provide some basic bash_it functionality that I've come to love for git. I base everything off of two perforce commands: $ p4 set This command does not require a connection the perforce server, it simply tells us if a directory is managed by the Perforce SCM or not. In addition the command: $ p4 opened is used to provide the list of pending changes in the client and the number of opened files in the client. The `p4 opened` command requires a connection to the perforce server, hence it's run under a `timeout` command. The "p4 opened" processing into it's own bash file that now has to be sourced at the top-level bash-it.sh. Since the processing in simple the newly added: _p4-opened-counts function returns a number of things that are not currently used, but since I had awk open and doing the processing, I've chosen to include them in the output anyway. Testing: - Tested with the powerline-multiline theme in a few perforce based workspaces/clients - Ran: ❯ shellcheck themes/p4helpers.theme.bash and fixed all the errors - Ran the test suite: ❯ test/run [...] 182 tests, 0 failures, 1 skipped --- bash_it.sh | 2 ++ themes/base.theme.bash | 35 ++++++++++++++++++++++ themes/p4helpers.theme.bash | 45 ++++++++++++++++++++++++++++ themes/powerline/powerline.base.bash | 2 ++ 4 files changed, 84 insertions(+) create mode 100644 themes/p4helpers.theme.bash diff --git a/bash_it.sh b/bash_it.sh index 70082205..6e87100d 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -60,6 +60,8 @@ done source "${BASH_IT}/themes/colors.theme.bash" # shellcheck source=./themes/githelpers.theme.bash source "${BASH_IT}/themes/githelpers.theme.bash" +# shellcheck source=./themes/p4helpers.theme.bash +source "${BASH_IT}/themes/p4helpers.theme.bash" # shellcheck source=./themes/base.theme.bash source "${BASH_IT}/themes/base.theme.bash" diff --git a/themes/base.theme.bash b/themes/base.theme.bash index a18c3729..fda845de 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -42,6 +42,12 @@ SCM_GIT_STAGED_CHAR="S:" SCM_GIT_STASH_CHAR_PREFIX="{" SCM_GIT_STASH_CHAR_SUFFIX="}" +SCM_P4='p4' +SCM_P4_CHAR='⌛' +SCM_P4_CHANGES_CHAR='C:' +SCM_P4_DEFAULT_CHAR='D:' +SCM_P4_OPENED_CHAR='O:' + SCM_HG='hg' SCM_HG_CHAR='☿' @@ -71,6 +77,7 @@ function scm { if [[ "$SCM_CHECK" = false ]]; then SCM=$SCM_NONE elif [[ -f .git/HEAD ]]; then SCM=$SCM_GIT elif which git &> /dev/null && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then SCM=$SCM_GIT + elif which p4 &> /dev/null && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then SCM=$SCM_P4 elif [[ -d .hg ]]; then SCM=$SCM_HG elif which hg &> /dev/null && [[ -n "$(hg root 2> /dev/null)" ]]; then SCM=$SCM_HG elif [[ -d .svn ]]; then SCM=$SCM_SVN @@ -81,6 +88,7 @@ function scm { 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 @@ -93,6 +101,7 @@ function scm_prompt_vars { 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 } @@ -125,6 +134,7 @@ function scm_prompt_info_common { fi # TODO: consider adding minimal status information for hg and svn + [[ ${SCM} == ${SCM_P4} ]] && p4_prompt_info && return [[ ${SCM} == ${SCM_HG} ]] && hg_prompt_info && return [[ ${SCM} == ${SCM_SVN} ]] && svn_prompt_info && return } @@ -193,6 +203,26 @@ function git_prompt_vars { 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 + + 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 2> /dev/null) ]]; then SCM_DIRTY=1 @@ -363,6 +393,11 @@ function git_prompt_info { 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}" +} + function svn_prompt_info { svn_prompt_vars echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}" diff --git a/themes/p4helpers.theme.bash b/themes/p4helpers.theme.bash new file mode 100644 index 00000000..27a777ac --- /dev/null +++ b/themes/p4helpers.theme.bash @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +function _p4-opened { + timeout 2.0s p4 opened -s 2> /dev/null +} + +function _p4-opened-counts { + # Return the following counts seperated by tabs: + # - count of opened files + # - count of pending changesets (other than defaults) + # - count of files in the default changeset + # - count of opened files in add mode + # - count of opened files in edit mode + # - count of opened files in delete mode + _p4-opened | awk ' + BEGIN { + opened=0; + type_array["edit"]=0; + type_array["add"]=0; + type_array["delete"]=0; + change_array["change"]=0; + } + { + # p4 opened prints one file per line, and all lines begin with "//" + # Here is an examples: + # + # $ p4 opened + # //depot/some/file.py#4 - edit change 716431 (text) + # //depot/another/file.py - edit default change (text) + # //now/add/a/newfile.sh - add change 435645 (text+k) + # + # + if ($1 ~ /^\/\//) { + opened += 1 + change_array[$5] += 1 + type_array[$3] += 1 + } + } + END { + default_changes=change_array["change"]; + non_default_changes=length(change_array) - 1; + print opened "\t" non_default_changes "\t" default_changes "\t" type_array["add"] "\t" type_array["edit"] "\t" type_array["delete"] + } +' +} diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index c352a87a..ade246e9 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -84,6 +84,8 @@ function __powerline_scm_prompt { fi if [[ "${SCM_GIT_CHAR}" == "${SCM_CHAR}" ]]; then scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" + elif [[ "${SCM_P4_CHAR}" == "${SCM_CHAR}" ]]; then + scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" fi echo "${scm_prompt}${scm}|${color}" fi From 396bedf11e4203350df903fd3988c076db24f791 Mon Sep 17 00:00:00 2001 From: Will Price Date: Fri, 16 Feb 2018 19:51:22 +0000 Subject: [PATCH 02/36] Improve documentation on prompt options for powerline themes --- themes/powerline-multiline/README.md | 21 +++++++++++++-------- themes/powerline-naked/README.md | 21 +++++++++++++-------- themes/powerline-plain/README.md | 21 +++++++++++++-------- themes/powerline/README.md | 21 +++++++++++++-------- 4 files changed, 52 insertions(+), 32 deletions(-) diff --git a/themes/powerline-multiline/README.md b/themes/powerline-multiline/README.md index 4ceebec6..acc199ac 100644 --- a/themes/powerline-multiline/README.md +++ b/themes/powerline-multiline/README.md @@ -46,14 +46,19 @@ The time/date is printed by the `date` command, so refer to its man page to chan The contents of both prompt sides can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: -* battery -* clock -* cwd -* in_vim -* python_venv -* ruby -* scm -* user_info +* `battery` - Battery information (you'll need to enable the `battery` plugin) +* `clock` - Current time in `HH:MM:SS` format +* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) +* `hostname` - Host name of machine +* `in_vim` - Show identifier if running in `:terminal` from vim +* `last_status` - Exit status of last run command +* `python_venv` - Python virtual environment information (`virtualenv`, `venv` + and `conda` supported) +* `ruby` - Current ruby version if using `rvm` +* `scm` - Version control information, `git` +* `user_info` - Current user +* `wd` - Working directory, like `cwd` but doesn't show the full folder + hierarchy, only the directory you're currently in. Two variables can be defined to set the order of the prompt segments: diff --git a/themes/powerline-naked/README.md b/themes/powerline-naked/README.md index 9ee38271..6928b862 100644 --- a/themes/powerline-naked/README.md +++ b/themes/powerline-naked/README.md @@ -42,14 +42,19 @@ The time/date is printed by the `date` command, so refer to its man page to chan The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: -* battery -* clock -* cwd -* in_vim -* python_venv -* ruby -* scm -* user_info +* `battery` - Battery information (you'll need to enable the `battery` plugin) +* `clock` - Current time in `HH:MM:SS` format +* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) +* `hostname` - Host name of machine +* `in_vim` - Show identifier if running in `:terminal` from vim +* `last_status` - Exit status of last run command +* `python_venv` - Python virtual environment information (`virtualenv`, `venv` + and `conda` supported) +* `ruby` - Current ruby version if using `rvm` +* `scm` - Version control information, `git` +* `user_info` - Current user +* `wd` - Working directory, like `cwd` but doesn't show the full folder + hierarchy, only the directory you're currently in. A variables can be defined to set the order of the prompt segments: diff --git a/themes/powerline-plain/README.md b/themes/powerline-plain/README.md index 6347d991..941666a2 100644 --- a/themes/powerline-plain/README.md +++ b/themes/powerline-plain/README.md @@ -40,14 +40,19 @@ The time/date is printed by the `date` command, so refer to its man page to chan The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: -* battery -* clock -* cwd -* in_vim -* python_venv -* ruby -* scm -* user_info +* `battery` - Battery information (you'll need to enable the `battery` plugin) +* `clock` - Current time in `HH:MM:SS` format +* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) +* `hostname` - Host name of machine +* `in_vim` - Show identifier if running in `:terminal` from vim +* `last_status` - Exit status of last run command +* `python_venv` - Python virtual environment information (`virtualenv`, `venv` + and `conda` supported) +* `ruby` - Current ruby version if using `rvm` +* `scm` - Version control information, `git` +* `user_info` - Current user +* `wd` - Working directory, like `cwd` but doesn't show the full folder + hierarchy, only the directory you're currently in. A variables can be defined to set the order of the prompt segments: diff --git a/themes/powerline/README.md b/themes/powerline/README.md index d0a46815..44e4a8e3 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -44,14 +44,19 @@ The time/date is printed by the `date` command, so refer to its man page to chan The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: -* battery -* clock -* cwd -* in_vim -* python_venv -* ruby -* scm -* user_info +* `battery` - Battery information (you'll need to enable the `battery` plugin) +* `clock` - Current time in `HH:MM:SS` format +* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`) +* `hostname` - Host name of machine +* `in_vim` - Show identifier if running in `:terminal` from vim +* `last_status` - Exit status of last run command +* `python_venv` - Python virtual environment information (`virtualenv`, `venv` + and `conda` supported) +* `ruby` - Current ruby version if using `rvm` +* `scm` - Version control information, `git` +* `user_info` - Current user +* `wd` - Working directory, like `cwd` but doesn't show the full folder + hierarchy, only the directory you're currently in. A variables can be defined to set the order of the prompt segments: From 45f79770fbb38ff6289299ab936d9da92ca5ad7f Mon Sep 17 00:00:00 2001 From: Vladimir Bolshakov Date: Sun, 18 Feb 2018 11:45:09 +0300 Subject: [PATCH 03/36] Add invoke (pyinvoke.org) completions --- completion/available/invoke.completion.bash | 30 +++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 completion/available/invoke.completion.bash diff --git a/completion/available/invoke.completion.bash b/completion/available/invoke.completion.bash new file mode 100644 index 00000000..aca64b26 --- /dev/null +++ b/completion/available/invoke.completion.bash @@ -0,0 +1,30 @@ +# Invoke (pyinvoke.org) tab-completion script to be sourced with Bash shell. + +_complete_invoke() { + local candidates + + # COMP_WORDS contains the entire command string up til now (including + # program name). + # We hand it to Invoke so it can figure out the current context: spit back + # core options, task names, the current task's options, or some combo. + candidates=`invoke --complete -- ${COMP_WORDS[*]}` + + # `compgen -W` takes list of valid options & a partial word & spits back + # possible matches. Necessary for any partial word completions (vs + # completions performed when no partial words are present). + # + # $2 is the current word or token being tabbed on, either empty string or a + # partial word, and thus wants to be compgen'd to arrive at some subset of + # our candidate list which actually matches. + # + # COMPREPLY is the list of valid completions handed back to `complete`. + COMPREPLY=( $(compgen -W "${candidates}" -- $2) ) +} + + +# Tell shell builtin to use the above for completing 'inv'/'invoke': +# * -F: use given function name to generate completions. +# * -o default: when function generates no results, use filenames. +# * positional args: program names to complete for. +complete -F _complete_invoke -o default invoke inv + From e8e9aa387bdec5f1f4ca8a84ab1e62d7d1ad1afe Mon Sep 17 00:00:00 2001 From: Vladimir Bolshakov Date: Mon, 19 Feb 2018 12:24:27 +0300 Subject: [PATCH 04/36] Add reference to pyinvoke original repo in completions file --- completion/available/invoke.completion.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/completion/available/invoke.completion.bash b/completion/available/invoke.completion.bash index aca64b26..f062bcab 100644 --- a/completion/available/invoke.completion.bash +++ b/completion/available/invoke.completion.bash @@ -1,4 +1,5 @@ # Invoke (pyinvoke.org) tab-completion script to be sourced with Bash shell. +# https://github.com/pyinvoke/invoke/blob/master/completion/bash _complete_invoke() { local candidates From 8d18d1f69cc66f5cf1c5072a4b8e307336ddbc8a Mon Sep 17 00:00:00 2001 From: Will Price Date: Mon, 19 Feb 2018 10:41:33 +0000 Subject: [PATCH 05/36] Correct variables -> variable in powerline theme READMEs --- themes/powerline-naked/README.md | 2 +- themes/powerline-plain/README.md | 2 +- themes/powerline/README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/powerline-naked/README.md b/themes/powerline-naked/README.md index 6928b862..510e0301 100644 --- a/themes/powerline-naked/README.md +++ b/themes/powerline-naked/README.md @@ -56,7 +56,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `wd` - Working directory, like `cwd` but doesn't show the full folder hierarchy, only the directory you're currently in. -A variables can be defined to set the order of the prompt segments: +A variable can be defined to set the order of the prompt segments: POWERLINE_PROMPT="user_info scm python_venv ruby cwd" diff --git a/themes/powerline-plain/README.md b/themes/powerline-plain/README.md index 941666a2..8c8647e3 100644 --- a/themes/powerline-plain/README.md +++ b/themes/powerline-plain/README.md @@ -54,7 +54,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `wd` - Working directory, like `cwd` but doesn't show the full folder hierarchy, only the directory you're currently in. -A variables can be defined to set the order of the prompt segments: +A variable can be defined to set the order of the prompt segments: POWERLINE_PROMPT="user_info scm python_venv ruby cwd" diff --git a/themes/powerline/README.md b/themes/powerline/README.md index 44e4a8e3..7c1a135c 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -58,7 +58,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `wd` - Working directory, like `cwd` but doesn't show the full folder hierarchy, only the directory you're currently in. -A variables can be defined to set the order of the prompt segments: +A variable can be defined to set the order of the prompt segments: POWERLINE_PROMPT="user_info scm python_venv ruby cwd" From dd6f158babcd7eabd26d3d847d4e16fcc00f8f4a Mon Sep 17 00:00:00 2001 From: Michy Amrane Date: Thu, 1 Mar 2018 15:13:29 +0100 Subject: [PATCH 06/36] new yarn aliases 'yarn global add' as 'yaga' 'yarn serve' as 'yas' --- aliases/available/yarn.aliases.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aliases/available/yarn.aliases.bash b/aliases/available/yarn.aliases.bash index c189aa8d..1e3eae39 100644 --- a/aliases/available/yarn.aliases.bash +++ b/aliases/available/yarn.aliases.bash @@ -5,6 +5,7 @@ about-alias 'yarn package manager aliases' alias ya='yarn' alias yai='yarn init' alias yaa='yarn add' +alias yaga='yarn global add' alias yaad='yarn add --dev' alias yau='yarn upgrade' alias yarm='yarn remove' @@ -14,6 +15,7 @@ alias yap='yarn publish' alias yasu='yarn self-update' alias yaru='yarn run' alias yat='yarn test' +alias yas='yarn serve' alias yacc='yarn cache clean' alias yack='yarn check' alias yals='yarn list' From 9e9978033ce91d565d9321079fd58b6f745e2f0c Mon Sep 17 00:00:00 2001 From: Eudaimonstro Date: Fri, 2 Mar 2018 19:05:00 -0800 Subject: [PATCH 07/36] Breaking up alias declarations into their own lines so that bash-it help aliases will register them --- aliases/available/clipboard.aliases.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aliases/available/clipboard.aliases.bash b/aliases/available/clipboard.aliases.bash index 21b770a6..528e2d0e 100644 --- a/aliases/available/clipboard.aliases.bash +++ b/aliases/available/clipboard.aliases.bash @@ -4,7 +4,9 @@ about-alias 'pbcopy and pbpaste shortcuts to linux' case $OSTYPE in linux*) XCLIP=$(command -v xclip) - [[ $XCLIP ]] && alias pbcopy="$XCLIP -selection clipboard" && alias pbpaste="$XCLIP -selection clipboard -o" + [[ $XCLIP ]] && \ + alias pbcopy="$XCLIP -selection clipboard" && \ + alias pbpaste="$XCLIP -selection clipboard -o" ;; esac From 3c7982d0def5668966d3609bf10809a008b60d68 Mon Sep 17 00:00:00 2001 From: LanikSJ Date: Sat, 3 Mar 2018 13:00:08 -0800 Subject: [PATCH 08/36] Change Vault Auth to Login --- aliases/available/vault.aliases.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aliases/available/vault.aliases.bash b/aliases/available/vault.aliases.bash index 7c98aa58..d2ad8e74 100644 --- a/aliases/available/vault.aliases.bash +++ b/aliases/available/vault.aliases.bash @@ -11,5 +11,5 @@ alias vasrv="vault server" alias vas="vault status" alias vav="vault version" alias vaw="vault write" -alias vag="vault auth -method=github" +alias vag="vault login -method=github" alias varv="vault read -field=value" From fff19e40038d1bf7c09fa02b04b6cea64980fec2 Mon Sep 17 00:00:00 2001 From: Jason Yu Date: Mon, 5 Mar 2018 13:24:13 +0000 Subject: [PATCH 09/36] Added alias that only list top level modules Credits to our mighty Evan You (creator of Vue.js) @yyx990803 https://gist.github.com/yyx990803/6045243 --- aliases/available/npm.aliases.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aliases/available/npm.aliases.bash b/aliases/available/npm.aliases.bash index 4623c738..67296fd1 100644 --- a/aliases/available/npm.aliases.bash +++ b/aliases/available/npm.aliases.bash @@ -20,3 +20,5 @@ alias nud='npm update' alias nr='npm run' alias nls='npm list' alias nlsg='npm list --global' +alias ng="npm list -g --depth=0 2>/dev/null" +alias nl="npm list --depth=0 2>/dev/null" From 7b17c17b096b398476ec0974bbe40bcdba535908 Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Mon, 5 Mar 2018 09:33:09 -0500 Subject: [PATCH 10/36] Add a comparison URL to version In order to make a swift comparison between the currently-installed version vs the latest commits on `master`, emit a clickable URL that will show the user the exact changes. Signed-off-by: Mike Fiedler --- lib/helpers.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/helpers.bash b/lib/helpers.bash index 81f7280b..9693ea1a 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -248,6 +248,7 @@ _bash-it-version() { echo "Current git SHA: $BASH_IT_GIT_VERSION_INFO" echo "$BASH_IT_GIT_URL/commit/$BASH_IT_GIT_SHA" + echo "Compare to latest: $BASH_IT_GIT_URL/compare/$BASH_IT_GIT_SHA...master" cd - &> /dev/null || return } From 137b700097e2610eb84dbd78815ab711403889b3 Mon Sep 17 00:00:00 2001 From: Julio Borja Barra Date: Wed, 7 Mar 2018 12:54:01 +0100 Subject: [PATCH 11/36] Change template for temp file creation This makes the script compatible with other 'versions' of `mktemp`. --- plugins/available/alias-completion.plugin.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/available/alias-completion.plugin.bash b/plugins/available/alias-completion.plugin.bash index b14131b4..e92389ef 100644 --- a/plugins/available/alias-completion.plugin.bash +++ b/plugins/available/alias-completion.plugin.bash @@ -29,7 +29,7 @@ function alias_completion { (( ${#completions[@]} == 0 )) && return 0 # create temporary file for wrapper functions and completions - local tmp_file; tmp_file="$(mktemp -t "${namespace}-${RANDOM}XXX.tmp")" || return 1 + local tmp_file; tmp_file="$(mktemp -t "${namespace}-${RANDOM}XXXXXX")" || return 1 local completion_loader; completion_loader="$(complete -p -D 2>/dev/null | sed -Ene 's/.* -F ([^ ]*).*/\1/p')" From cb783008208064cfc661b744a1bb3f949d8a46d7 Mon Sep 17 00:00:00 2001 From: Jason Yu Date: Thu, 8 Mar 2018 18:41:02 +0000 Subject: [PATCH 12/36] Update npm.aliases.bash --- aliases/available/npm.aliases.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aliases/available/npm.aliases.bash b/aliases/available/npm.aliases.bash index 67296fd1..a48cb8ae 100644 --- a/aliases/available/npm.aliases.bash +++ b/aliases/available/npm.aliases.bash @@ -20,5 +20,5 @@ alias nud='npm update' alias nr='npm run' alias nls='npm list' alias nlsg='npm list --global' -alias ng="npm list -g --depth=0 2>/dev/null" -alias nl="npm list --depth=0 2>/dev/null" +alias npml="npm list --depth=0 2>/dev/null" +alias npmlg="npm list -g --depth=0 2>/dev/null" From 794ff103c7055840f9182cff4524932b04df8755 Mon Sep 17 00:00:00 2001 From: Michy Amrane Date: Tue, 13 Mar 2018 21:55:48 +0100 Subject: [PATCH 13/36] another alias ^^ --- aliases/available/yarn.aliases.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/aliases/available/yarn.aliases.bash b/aliases/available/yarn.aliases.bash index 1e3eae39..b50535b9 100644 --- a/aliases/available/yarn.aliases.bash +++ b/aliases/available/yarn.aliases.bash @@ -9,6 +9,7 @@ alias yaga='yarn global add' alias yaad='yarn add --dev' alias yau='yarn upgrade' alias yarm='yarn remove' +alias yagrm='yarn global remove' alias yaod='yarn outdated' alias yapa='yarn pack' alias yap='yarn publish' From f168ce8109ac1572565acf0c8f4cd5b186662212 Mon Sep 17 00:00:00 2001 From: Kai-Ming Guo Date: Thu, 15 Mar 2018 22:57:02 +0800 Subject: [PATCH 14/36] Add reset launchpad layout function The layout will have returned to the default, placing all bundled apps onto the first screen of Launchpad, and third party apps onto the secondary (and third, if applicable) screens --- plugins/available/osx.plugin.bash | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/available/osx.plugin.bash b/plugins/available/osx.plugin.bash index c1d2b18b..044b4d7e 100644 --- a/plugins/available/osx.plugin.bash +++ b/plugins/available/osx.plugin.bash @@ -95,5 +95,18 @@ function prevcurl() { curl "$*" | open -fa $PREVIEW } +function refresh-launchpad() { + about 'Reset launchpad layout in macOS' + example '$ refresh-launchpad' + group 'osx' + + if [ $(uname) = "Darwin" ];then + defaults write com.apple.dock ResetLaunchPad -bool TRUE + killall Dock + else + echo "Sorry, this only works on Mac OS X" + fi +} + # Make this backwards compatible alias pcurl='prevcurl' From 82ee86222e782b6cf1483f4bd0636513ba729a56 Mon Sep 17 00:00:00 2001 From: polytomous Date: Fri, 16 Mar 2018 18:51:48 -0700 Subject: [PATCH 15/36] INSANE EDIT: Pick a less crazy word than "sane" --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 7fa8cacf..c0848cdb 100755 --- a/install.sh +++ b/install.sh @@ -167,7 +167,7 @@ then done else echo "" - echo -e "\033[0;32mEnabling sane defaults\033[0m" + echo -e "\033[0;32mEnabling reasonable defaults\033[0m" _enable-completion bash-it _enable-completion system _enable-plugin base From 0c656bf26949f7094fc882502c1e5f3764cdc63d Mon Sep 17 00:00:00 2001 From: cornfeedhobo Date: Sat, 17 Mar 2018 13:06:13 -0500 Subject: [PATCH 16/36] add nodenv plugin --- plugins/available/nodenv.plugin.bash | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 plugins/available/nodenv.plugin.bash diff --git a/plugins/available/nodenv.plugin.bash b/plugins/available/nodenv.plugin.bash new file mode 100644 index 00000000..f28e4045 --- /dev/null +++ b/plugins/available/nodenv.plugin.bash @@ -0,0 +1,10 @@ +cite about-plugin +about-plugin 'load nodenv, if you are using it' + +export NODENV_ROOT="$HOME/.nodenv" +pathmunge "$NODENV_ROOT/bin" + +[[ `which nodenv` ]] && eval "$(nodenv init -)" + +# Load the auto-completion script if nodenv was loaded. +[[ -e $NODENV_ROOT/completions/nodenv.bash ]] && source $NODENV_ROOT/completions/nodenv.bash From f1aa5a7ac9714a238f37a95521cf4bec36079942 Mon Sep 17 00:00:00 2001 From: Jason Yu Date: Tue, 20 Mar 2018 07:53:49 +0000 Subject: [PATCH 17/36] Update npm.aliases.bash --- aliases/available/npm.aliases.bash | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/aliases/available/npm.aliases.bash b/aliases/available/npm.aliases.bash index a48cb8ae..2266fe22 100644 --- a/aliases/available/npm.aliases.bash +++ b/aliases/available/npm.aliases.bash @@ -18,7 +18,5 @@ alias nod='npm outdated' alias nrb='npm rebuild' alias nud='npm update' alias nr='npm run' -alias nls='npm list' -alias nlsg='npm list --global' -alias npml="npm list --depth=0 2>/dev/null" -alias npmlg="npm list -g --depth=0 2>/dev/null" +alias nls='npm list --depth=0 2>/dev/null' +alias nlsg='npm list -g --depth=0 2>/dev/null' From f8fd94d46fefddaa99bc974997ce6c2a7a1a90f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Rogo=C5=BCa?= Date: Mon, 2 Apr 2018 01:55:36 +0200 Subject: [PATCH 18/36] Fixed opening vim --- plugins/available/alias-completion.plugin.bash | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/available/alias-completion.plugin.bash b/plugins/available/alias-completion.plugin.bash index e92389ef..e1c4ade7 100644 --- a/plugins/available/alias-completion.plugin.bash +++ b/plugins/available/alias-completion.plugin.bash @@ -56,7 +56,7 @@ function alias_completion { continue fi fi - local new_completion="$(complete -p "$alias_cmd")" + local new_completion="$(complete -p "$alias_cmd" 2>/dev/null)" # create a wrapper inserting the alias arguments if any if [[ -n $alias_args ]]; then @@ -77,8 +77,10 @@ function alias_completion { fi # replace completion trigger by alias - new_completion="${new_completion% *} $alias_name" - echo "$new_completion" >> "$tmp_file" + if [[ -n $new_completion ]]; then + new_completion="${new_completion% *} $alias_name" + echo "$new_completion" >> "$tmp_file" + fi done < <(alias -p | sed -Ene "s/$alias_regex/\2 '\3' '\4'/p") source "$tmp_file" && rm -f "$tmp_file" }; alias_completion From 0b73975d04cf3d9533d4b61b1fc91c8b1cc3c079 Mon Sep 17 00:00:00 2001 From: Yukino Song Date: Tue, 10 Apr 2018 17:12:22 +0800 Subject: [PATCH 19/36] Add support for pyenv-virtualenv --- plugins/available/virtualenv.plugin.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/available/virtualenv.plugin.bash b/plugins/available/virtualenv.plugin.bash index 651bfec7..570a03d2 100644 --- a/plugins/available/virtualenv.plugin.bash +++ b/plugins/available/virtualenv.plugin.bash @@ -3,7 +3,11 @@ cite about-plugin about-plugin 'virtualenvwrapper helper functions' -[[ `which virtualenvwrapper.sh` ]] && . virtualenvwrapper.sh +if [[ `command -v pyenv` ]]; then + pyenv virtualenvwrapper +else + [[ `which virtualenvwrapper.sh` ]] && . virtualenvwrapper.sh +fi function mkvenv { From fa266e9b0c729db601decadb4bfc8da6a0018160 Mon Sep 17 00:00:00 2001 From: Yukino Song Date: Wed, 11 Apr 2018 14:59:56 +0800 Subject: [PATCH 20/36] Change to _command_exists helper --- plugins/available/virtualenv.plugin.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/available/virtualenv.plugin.bash b/plugins/available/virtualenv.plugin.bash index 570a03d2..468870cd 100644 --- a/plugins/available/virtualenv.plugin.bash +++ b/plugins/available/virtualenv.plugin.bash @@ -1,9 +1,9 @@ # make sure virtualenvwrapper is enabled if available cite about-plugin -about-plugin 'virtualenvwrapper helper functions' +about-plugin 'virtualenvwrapper and pyenv-virtualenvwrapper helper functions' -if [[ `command -v pyenv` ]]; then +if _command_exists pyenv; then pyenv virtualenvwrapper else [[ `which virtualenvwrapper.sh` ]] && . virtualenvwrapper.sh From f8d5ffe84c906f059b6d7ff42d79628e64fbb6c2 Mon Sep 17 00:00:00 2001 From: Florian Molitorisz Date: Wed, 11 Apr 2018 17:37:29 +0200 Subject: [PATCH 21/36] fix hostname prompt https://github.com/Bash-it/bash-it/issues/1145 --- themes/powerline-multiline/powerline-multiline.theme.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/themes/powerline-multiline/powerline-multiline.theme.bash b/themes/powerline-multiline/powerline-multiline.theme.bash index 4f4f8917..a62a7060 100644 --- a/themes/powerline-multiline/powerline-multiline.theme.bash +++ b/themes/powerline-multiline/powerline-multiline.theme.bash @@ -51,6 +51,8 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} IN_VIM_THEME_PROMPT_COLOR=245 IN_VIM_THEME_PROMPT_TEXT="vim" +HOST_THEME_PROMPT_COLOR=0 + POWERLINE_LEFT_PROMPT=${POWERLINE_LEFT_PROMPT:="scm python_venv ruby cwd"} POWERLINE_RIGHT_PROMPT=${POWERLINE_RIGHT_PROMPT:="in_vim clock battery user_info"} From 46c25769c7870d9e886bc5427d5747ea7450109c Mon Sep 17 00:00:00 2001 From: Joe Leong Date: Sat, 14 Apr 2018 00:10:35 -0400 Subject: [PATCH 22/36] Update pipenv completion use `--completion` from pypa/pipenv docs instead of old `_PIPENV_COMPLETE` --- completion/available/pipenv.completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/completion/available/pipenv.completion.bash b/completion/available/pipenv.completion.bash index 95ae87b7..339509f2 100644 --- a/completion/available/pipenv.completion.bash +++ b/completion/available/pipenv.completion.bash @@ -1 +1 @@ -[[ -x "$(which pipenv)" ]] && source <(env _PIPENV_COMPLETE="source-bash" pipenv) +[[ -x "$(which pipenv)" ]] && eval "$(pipenv --completion)" From e6a6bb5debdd3485c9d150ae44ef3fdda0cc511e Mon Sep 17 00:00:00 2001 From: Jason Al-Mansor Date: Sun, 15 Apr 2018 14:32:18 -0400 Subject: [PATCH 23/36] fix hostname in remaining powerline themes --- themes/powerline-naked/powerline-naked.theme.bash | 2 ++ themes/powerline-plain/powerline-plain.theme.bash | 2 ++ themes/powerline/powerline.theme.bash | 2 ++ 3 files changed, 6 insertions(+) diff --git a/themes/powerline-naked/powerline-naked.theme.bash b/themes/powerline-naked/powerline-naked.theme.bash index 26633108..f8fb6499 100644 --- a/themes/powerline-naked/powerline-naked.theme.bash +++ b/themes/powerline-naked/powerline-naked.theme.bash @@ -47,6 +47,8 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} IN_VIM_THEME_PROMPT_COLOR=245 IN_VIM_THEME_PROMPT_TEXT="vim" +HOST_THEME_PROMPT_COLOR=254 + POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"} safe_append_prompt_command __powerline_prompt_command diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash index 6e0796d7..ce7943c7 100644 --- a/themes/powerline-plain/powerline-plain.theme.bash +++ b/themes/powerline-plain/powerline-plain.theme.bash @@ -43,6 +43,8 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} IN_VIM_THEME_PROMPT_COLOR=245 IN_VIM_THEME_PROMPT_TEXT="vim" +HOST_THEME_PROMPT_COLOR=0 + POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"} safe_append_prompt_command __powerline_prompt_command diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index 12de9cbe..df72a73f 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -46,6 +46,8 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} IN_VIM_THEME_PROMPT_COLOR=245 IN_VIM_THEME_PROMPT_TEXT="vim" +HOST_THEME_PROMPT_COLOR=0 + POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"} safe_append_prompt_command __powerline_prompt_command From ea1f2358563aef64abc7242d68b5d77ff9f43617 Mon Sep 17 00:00:00 2001 From: Florian Molitorisz Date: Wed, 18 Apr 2018 00:44:45 +0200 Subject: [PATCH 24/36] fix wd_prompt multiline croping --- themes/powerline/powerline.base.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index ade246e9..9f4914e9 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -102,7 +102,8 @@ function __powerline_hostname_prompt { } function __powerline_wd_prompt { - echo "\W|${CWD_THEME_PROMPT_COLOR}" + local wd=${PWD##*/} + echo "${wd}|${WD_THEME_PROMPT_COLOR}" } function __powerline_clock_prompt { From b538712dc302cefe472ba287fcb31dffd61623d3 Mon Sep 17 00:00:00 2001 From: Vangelis Tasoulas Date: Thu, 19 Apr 2018 18:34:00 +0200 Subject: [PATCH 25/36] Rewrote the terraform bash completion Signed-off-by: Vangelis Tasoulas --- .../available/terraform.completion.bash | 64 +++++++++++-------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/completion/available/terraform.completion.bash b/completion/available/terraform.completion.bash index 11985f1d..6052a33e 100644 --- a/completion/available/terraform.completion.bash +++ b/completion/available/terraform.completion.bash @@ -1,35 +1,49 @@ #!/usr/bin/env bash -# Bash Terraform completion -# Source: https://gist.github.com/cornfeedhobo/8bc08747ec3add1fc5adb2edb7cd68d3 +# Bash completion for the terraform command +# +# Copyright (c) 2018 Vangelis Tasoulas . _terraform() { - local cur prev words cword opts - _get_comp_words_by_ref -n : cur prev words cword - COMPREPLY=() - opts="" + local cur prev words cword opts + _get_comp_words_by_ref -n : cur prev words cword + COMPREPLY=() + opts="" - if [[ ${cur} == -* ]] ; then - compopt -o nospace - fi + if [[ ${cword} -eq 1 ]] ; then - if [[ ${cword} -eq 1 ]] ; then - if [[ ${cur} == -* ]] ; then - opts="--help --version" - else - opts="$(terraform --help | grep -vE '(usage|Available|^$)' | awk '{print $1}')" - fi - fi + # Options that do not start with a hyphen, are always starting with four spaces. + opts="$(terraform --help | grep -P '^\s\s\s\s\S' | awk '{print $1}')" + opts="${opts} --help --version" - if [[ ${cword} -gt 1 ]] ; then - if [[ ${cword} -eq 2 && ${prev} == '--help' ]] ; then - opts="$(terraform --help | grep -vE '(usage|Available|^$)' | awk '{print $1}')" - else - opts="$(terraform --help "${words[1]}" | grep '^ *-[a-z]' | awk '{print $1}' | awk -F '=' '{if ($0 ~ /=/) {print $1"="} else {print $1" "}}')" - fi - fi + elif [[ ${cword} -gt 1 ]] ; then - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 + if [[ ${cword} -eq 2 && ${prev} == '--help' ]] ; then + + opts="$(terraform --help | grep -P '^\s\s\s\s\S' | awk '{print $1}')" + + elif [[ ${words[1]} != "--help" && ${words[1]} != "--version" && ${words[1]} != "version" ]] ; then + + # Some commands acceps hyphened parameters,... + opts="$(terraform --help "${words[1]}" | grep -P '^\s+-' | awk '{print $1}' | awk -F '=' '{ if ($0 ~ /=/) {print $1"="} else {print $1} }')" + # but some other commands accept non hyphened parameters.... + opts="${opts} $(terraform --help "${words[1]}" | grep -P '^\s\s\s\s\S' | awk '{print $1}')" + # All of the commands accept the --help parameter which is not listed + # by the 'terraform --help + opts="${opts} --help" + + fi + fi + + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + + if [[ ${#COMPREPLY[*]} -eq 1 ]] ; then + if [[ ${COMPREPLY[0]} == *= ]]; then + # When only one completion is left, check if there is an equal sign. + # If an equal sign, then add no space after the autocompleted word. + compopt -o nospace; + fi + fi + return 0 } complete -F _terraform terraform From 880ea9f07ea9957df81af07528798f18e8c5b1f0 Mon Sep 17 00:00:00 2001 From: Vangelis Tasoulas Date: Thu, 19 Apr 2018 18:40:22 +0200 Subject: [PATCH 26/36] Added GPL2 header to the terraform bash completion script. Signed-off-by: Vangelis Tasoulas --- completion/available/terraform.completion.bash | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/completion/available/terraform.completion.bash b/completion/available/terraform.completion.bash index 6052a33e..12bf218e 100644 --- a/completion/available/terraform.completion.bash +++ b/completion/available/terraform.completion.bash @@ -1,7 +1,22 @@ #!/usr/bin/env bash +# # Bash completion for the terraform command +# +# Copyright (C) 2018 Vangelis Tasoulas # -# Copyright (c) 2018 Vangelis Tasoulas . +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. _terraform() { local cur prev words cword opts From 9efc944f19092a9616c2a7cddb739f4394e442ad Mon Sep 17 00:00:00 2001 From: Vangelis Tasoulas Date: Thu, 19 Apr 2018 18:42:13 +0200 Subject: [PATCH 27/36] The capistrano completion script should not have the executable bit set No other script in the completion/available folder does. Signed-off-by: Vangelis Tasoulas --- completion/available/capistrano.completion.bash | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 completion/available/capistrano.completion.bash diff --git a/completion/available/capistrano.completion.bash b/completion/available/capistrano.completion.bash old mode 100755 new mode 100644 From 039a677bd89963cd08a778807a5093a27bb3b34a Mon Sep 17 00:00:00 2001 From: Vangelis Tasoulas Date: Thu, 19 Apr 2018 18:50:00 +0200 Subject: [PATCH 28/36] Corrected a typo Signed-off-by: Vangelis Tasoulas --- completion/available/terraform.completion.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/completion/available/terraform.completion.bash b/completion/available/terraform.completion.bash index 12bf218e..1836c5ba 100644 --- a/completion/available/terraform.completion.bash +++ b/completion/available/terraform.completion.bash @@ -38,9 +38,9 @@ _terraform() { elif [[ ${words[1]} != "--help" && ${words[1]} != "--version" && ${words[1]} != "version" ]] ; then - # Some commands acceps hyphened parameters,... + # Some commands accept hyphened parameters, ... opts="$(terraform --help "${words[1]}" | grep -P '^\s+-' | awk '{print $1}' | awk -F '=' '{ if ($0 ~ /=/) {print $1"="} else {print $1} }')" - # but some other commands accept non hyphened parameters.... + # but some other commands accept non-hyphened parameters. opts="${opts} $(terraform --help "${words[1]}" | grep -P '^\s\s\s\s\S' | awk '{print $1}')" # All of the commands accept the --help parameter which is not listed # by the 'terraform --help From fd01635e4abe891998bcc3f81a73880ef9ca8237 Mon Sep 17 00:00:00 2001 From: Vangelis Tasoulas Date: Thu, 19 Apr 2018 18:54:29 +0200 Subject: [PATCH 29/36] Code consistency improvements Signed-off-by: Vangelis Tasoulas --- completion/available/terraform.completion.bash | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/completion/available/terraform.completion.bash b/completion/available/terraform.completion.bash index 1836c5ba..9fe0795a 100644 --- a/completion/available/terraform.completion.bash +++ b/completion/available/terraform.completion.bash @@ -18,7 +18,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -_terraform() { +_terraform() +{ local cur prev words cword opts _get_comp_words_by_ref -n : cur prev words cword COMPREPLY=() @@ -52,10 +53,10 @@ _terraform() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) if [[ ${#COMPREPLY[*]} -eq 1 ]] ; then - if [[ ${COMPREPLY[0]} == *= ]]; then + if [[ ${COMPREPLY[0]} == *= ]] ; then # When only one completion is left, check if there is an equal sign. # If an equal sign, then add no space after the autocompleted word. - compopt -o nospace; + compopt -o nospace fi fi return 0 From 3f2c2ddddd6d6088b5dc63447beb0af155bda00f Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Fri, 20 Apr 2018 08:00:06 +0200 Subject: [PATCH 30/36] Revert "fix wd_prompt multiline croping" --- themes/powerline/powerline.base.bash | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index 9f4914e9..ade246e9 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -102,8 +102,7 @@ function __powerline_hostname_prompt { } function __powerline_wd_prompt { - local wd=${PWD##*/} - echo "${wd}|${WD_THEME_PROMPT_COLOR}" + echo "\W|${CWD_THEME_PROMPT_COLOR}" } function __powerline_clock_prompt { From 98c44fcc1e19b52d5824244594e60a622806e0a0 Mon Sep 17 00:00:00 2001 From: Ricardo Lima Date: Sat, 21 Apr 2018 21:55:42 -0400 Subject: [PATCH 31/36] Fix quoting in the Explain plugin Fixes bug where Bash prints a "command not found" message when the function is run, due to incorrect quoting of the argument to the meta function example. --- plugins/available/explain.plugin.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/available/explain.plugin.bash b/plugins/available/explain.plugin.bash index d57b78e2..1fb38bdd 100644 --- a/plugins/available/explain.plugin.bash +++ b/plugins/available/explain.plugin.bash @@ -5,7 +5,7 @@ explain () { about 'explain any bash command via mankier.com manpage API' param '1: Name of the command to explain' example '$ explain # interactive mode. Type commands to explain in REPL' - example '$ explain 'cmd -o | ...' # one quoted command to explain it.' + example '$ explain '"'"'cmd -o | ...'"'"' # one quoted command to explain it.' group 'explain' if [ "$#" -eq 0 ]; then From 67629aba2d7a5404723f5ca1f3029d6eff24c263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Rogo=C5=BCa?= Date: Tue, 24 Apr 2018 21:50:34 +0200 Subject: [PATCH 32/36] On some hosts scm* functions does not work properly if a vcs tool is missing --- themes/base.theme.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index fda845de..22f53a67 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -75,12 +75,12 @@ RBFU_THEME_PROMPT_SUFFIX='|' function scm { if [[ "$SCM_CHECK" = false ]]; then SCM=$SCM_NONE - elif [[ -f .git/HEAD ]]; then SCM=$SCM_GIT + elif [[ -f .git/HEAD ]] && which git &> /dev/null; then SCM=$SCM_GIT elif which git &> /dev/null && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then SCM=$SCM_GIT elif which p4 &> /dev/null && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then SCM=$SCM_P4 - elif [[ -d .hg ]]; then SCM=$SCM_HG + elif [[ -d .hg ]] && which hg &> /dev/null; then SCM=$SCM_HG elif which hg &> /dev/null && [[ -n "$(hg root 2> /dev/null)" ]]; then SCM=$SCM_HG - elif [[ -d .svn ]]; then SCM=$SCM_SVN + elif [[ -d .svn ]] && which svn &> /dev/null; then SCM=$SCM_SVN else SCM=$SCM_NONE fi } From 209a55ab9fe03700daab250c3a76921ec589ec27 Mon Sep 17 00:00:00 2001 From: Ahmed Kamal Date: Wed, 25 Apr 2018 22:18:59 +0200 Subject: [PATCH 33/36] Use -E instead of -P for OSX compatibility --- completion/available/terraform.completion.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/completion/available/terraform.completion.bash b/completion/available/terraform.completion.bash index 9fe0795a..201b7267 100644 --- a/completion/available/terraform.completion.bash +++ b/completion/available/terraform.completion.bash @@ -28,21 +28,21 @@ _terraform() if [[ ${cword} -eq 1 ]] ; then # Options that do not start with a hyphen, are always starting with four spaces. - opts="$(terraform --help | grep -P '^\s\s\s\s\S' | awk '{print $1}')" + opts="$(terraform --help | grep -E '^\s\s\s\s\S' | awk '{print $1}')" opts="${opts} --help --version" elif [[ ${cword} -gt 1 ]] ; then if [[ ${cword} -eq 2 && ${prev} == '--help' ]] ; then - opts="$(terraform --help | grep -P '^\s\s\s\s\S' | awk '{print $1}')" + opts="$(terraform --help | grep -E '^\s\s\s\s\S' | awk '{print $1}')" elif [[ ${words[1]} != "--help" && ${words[1]} != "--version" && ${words[1]} != "version" ]] ; then # Some commands accept hyphened parameters, ... - opts="$(terraform --help "${words[1]}" | grep -P '^\s+-' | awk '{print $1}' | awk -F '=' '{ if ($0 ~ /=/) {print $1"="} else {print $1} }')" + opts="$(terraform --help "${words[1]}" | grep -E '^\s+-' | awk '{print $1}' | awk -F '=' '{ if ($0 ~ /=/) {print $1"="} else {print $1} }')" # but some other commands accept non-hyphened parameters. - opts="${opts} $(terraform --help "${words[1]}" | grep -P '^\s\s\s\s\S' | awk '{print $1}')" + opts="${opts} $(terraform --help "${words[1]}" | grep -E '^\s\s\s\s\S' | awk '{print $1}')" # All of the commands accept the --help parameter which is not listed # by the 'terraform --help opts="${opts} --help" From 846f730a9eac6c7e3db13b3b6df5a7c4d43e6b10 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Wed, 13 Dec 2017 10:32:47 +0100 Subject: [PATCH 34/36] Renamed "fd" function to "fcd" to avoid clash with "fd" tool --- plugins/available/fzf.plugin.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/available/fzf.plugin.bash b/plugins/available/fzf.plugin.bash index c4fa451e..69775c75 100644 --- a/plugins/available/fzf.plugin.bash +++ b/plugins/available/fzf.plugin.bash @@ -18,11 +18,11 @@ fe() { [[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}" } -fd() { +fcd() { about "cd to the selected directory" group "fzf" param "1: Directory to browse, or . if omitted" - example "fd aliases" + example "fcd aliases" local dir dir=$(find ${1:-.} -path '*/\.*' -prune \ From b96596dadce68aeb59f7d20a7152f080507c09e1 Mon Sep 17 00:00:00 2001 From: Arunvel Sriram Date: Wed, 25 Apr 2018 19:09:05 +0530 Subject: [PATCH 35/36] Make powerline-naked left prompt char configurable --- themes/powerline-naked/powerline-naked.base.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/powerline-naked/powerline-naked.base.bash b/themes/powerline-naked/powerline-naked.base.bash index 1939dfca..f6b11f42 100644 --- a/themes/powerline-naked/powerline-naked.base.bash +++ b/themes/powerline-naked/powerline-naked.base.bash @@ -4,7 +4,7 @@ function __powerline_left_segment { local OLD_IFS="${IFS}"; IFS="|" local params=( $1 ) IFS="${OLD_IFS}" - local separator_char="" + local separator_char="${POWERLINE_LEFT_SEPARATOR}" local separator="" if [[ "${SEGMENTS_AT_LEFT}" -gt 0 ]]; then From a3f5d4de91de5cbe524f5d840e51adf7364a24d5 Mon Sep 17 00:00:00 2001 From: Arunvel Sriram Date: Fri, 27 Apr 2018 11:58:30 +0530 Subject: [PATCH 36/36] Move variable declaration to the right place --- themes/powerline-naked/powerline-naked.theme.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/powerline-naked/powerline-naked.theme.bash b/themes/powerline-naked/powerline-naked.theme.bash index f8fb6499..1897a6ba 100644 --- a/themes/powerline-naked/powerline-naked.theme.bash +++ b/themes/powerline-naked/powerline-naked.theme.bash @@ -1,9 +1,10 @@ #!/usr/bin/env bash +POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} + . "$BASH_IT/themes/powerline-naked/powerline-naked.base.bash" PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""} -POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} USER_INFO_SSH_CHAR=${POWERLINE_USER_INFO_SSH_CHAR:=" "} USER_INFO_THEME_PROMPT_COLOR=240