From 7f0395a1d0e3f8c3cba7a4b2f0b8b718b34a87ba Mon Sep 17 00:00:00 2001 From: guneysus Date: Sat, 17 Jan 2015 23:41:01 +0200 Subject: [PATCH 001/123] Powerturk theme derived from powerline theme --- themes/powerturk/powerturk.theme.bash | 185 ++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 themes/powerturk/powerturk.theme.bash diff --git a/themes/powerturk/powerturk.theme.bash b/themes/powerturk/powerturk.theme.bash new file mode 100644 index 00000000..ccda0b39 --- /dev/null +++ b/themes/powerturk/powerturk.theme.bash @@ -0,0 +1,185 @@ +#!/usr/bin/env bash +# Power-Turk theme for bash-it +# Author (C) 2015 Ahmed Seref Guneysu + +THEME_PROMPT_SEPARATOR="" + +SHELL_SSH_CHAR=" " +SHELL_THEME_PROMPT_COLOR=2 +SHELL_SSH_THEME_PROMPT_COLOR=208 + +VIRTUALENV_CHAR="ⓔ " +VIRTUALENV_THEME_PROMPT_COLOR=35 + +SCM_NONE_CHAR="" + +SCM_GIT_CHAR=" " # " " + +SCM_THEME_PROMPT_CLEAN="" +SCM_THEME_PROMPT_DIRTY="" + +SCM_THEME_PROMPT_COLOR=16 +SCM_THEME_PROMPT_CLEAN_COLOR=231 +SCM_THEME_PROMPT_DIRTY_COLOR=196 +SCM_THEME_PROMPT_STAGED_COLOR=220 +SCM_THEME_PROMPT_UNSTAGED_COLOR=166 + +CWD_THEME_PROMPT_COLOR=240 + +LAST_STATUS_THEME_PROMPT_COLOR=52 + +_collapsed_wd() { + # echo -e "\u2771\u276d\u276f" + echo $(pwd | perl -pe " + BEGIN { + binmode STDIN, ':encoding(UTF-8)'; + binmode STDOUT, ':encoding(UTF-8)'; + }; s|^$HOME||g; s|/([^/])[^/]*(?=/)|/\$1|g") | \ + sed -re "s/\//  /g" +} + +_swd(){ +# Adapted from http://stackoverflow.com/a/2951707/1766716 + begin="" # The unshortened beginning of the path. + shortbegin="" # The shortened beginning of the path. + current="" # The section of the path we're currently working on. + end="${2:-$(pwd)}/" # The unmodified rest of the path. + + if [[ "$end" =~ "$HOME" ]]; then + INHOME=1 + end="${end#$HOME}" #strip /home/username from start of string + begin="$HOME" #start expansion from the right spot + else + INHOME=0 + fi + + end="${end#/}" # Strip the first / + shortenedpath="$end" # The whole path, to check the length. + maxlength="${1:-0}" + + shopt -q nullglob && NGV="-s" || NGV="-u" # Store the value for later. + shopt -s nullglob # Without this, anything that doesn't exist in the filesystem turns into */*/*/... + + while [[ "$end" ]] && (( ${#shortenedpath} > maxlength )) + do + current="${end%%/*}" # everything before the first / + end="${end#*/}" # everything after the first / + + shortcur="$current" + shortcurstar="$current" # No star if we don't shorten it. + + for ((i=${#current}-2; i>=0; i--)); do + subcurrent="${current:0:i}" + matching=("$begin/$subcurrent"*) # Array of all files that start with $subcurrent. + (( ${#matching[*]} != 1 )) && break # Stop shortening if more than one file matches. + shortcur="$subcurrent" + shortcurstar="$subcurrent*" + done + + #advance + begin="$begin/$current" + shortbegin="$shortbegin/$shortcurstar" + shortenedpath="$shortbegin/$end" + done + + shortenedpath="${shortenedpath%/}" # strip trailing / + shortenedpath="${shortenedpath#/}" # strip leading / + + # Replaces slashes with  except first occurence. + if [ $INHOME -eq 1 ]; then + echo "~/$shortenedpath" | sed "s/\///2g" # make sure it starts with ~/ + else + echo "/$shortenedpath" | sed "s/\///2g" # Make sure it starts with / + fi + + shopt "$NGV" nullglob # Reset nullglob in case this is being used as a function. + +} +function set_rgb_color { + if [[ "${1}" != "-" ]]; then + fg="38;5;${1}" + fi + if [[ "${2}" != "-" ]]; then + bg="48;5;${2}" + [[ -n "${fg}" ]] && bg=";${bg}" + fi + echo -e "\[\033[${fg}${bg}m\]" +} + +function powerline_shell_prompt { + if [[ -n "${SSH_CLIENT}" ]]; then + SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_SSH_THEME_PROMPT_COLOR}) ${SHELL_SSH_CHAR}\u@\h ${normal}" + LAST_THEME_COLOR=${SHELL_SSH_THEME_PROMPT_COLOR} + else + SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_THEME_PROMPT_COLOR}) ${normal}" + LAST_THEME_COLOR=${SHELL_THEME_PROMPT_COLOR} + fi +} + +function powerline_virtualenv_prompt { + local environ="" + + if [[ -n "$CONDA_DEFAULT_ENV" ]]; then + environ="conda: $CONDA_DEFAULT_ENV" + elif [[ -n "$VIRTUAL_ENV" ]]; then + environ=$(basename "$VIRTUAL_ENV") + fi + + if [[ -n "$environ" ]]; then + VIRTUALENV_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${VIRTUALENV_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${VIRTUALENV_THEME_PROMPT_COLOR}) ${VIRTUALENV_CHAR}$environ ${normal}" + LAST_THEME_COLOR=${VIRTUALENV_THEME_PROMPT_COLOR} + else + VIRTUALENV_PROMPT="" + fi +} + +function powerline_scm_prompt { + scm_prompt_vars + + if [[ "${SCM_NONE_CHAR}" != "${SCM_CHAR}" ]]; then + if [[ "${SCM_DIRTY}" -eq 3 ]]; then + SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_STAGED_COLOR} ${SCM_THEME_PROMPT_COLOR})" + elif [[ "${SCM_DIRTY}" -eq 2 ]]; then + SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_UNSTAGED_COLOR} ${SCM_THEME_PROMPT_COLOR})" + elif [[ "${SCM_DIRTY}" -eq 1 ]]; then + SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_DIRTY_COLOR} ${SCM_THEME_PROMPT_COLOR})" + else + SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_CLEAN_COLOR} ${SCM_THEME_PROMPT_COLOR})" + fi + if [[ "${SCM_GIT_CHAR}" == "${SCM_CHAR}" ]]; then + SCM_PROMPT+=" ${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" + fi + SCM_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${SCM_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}${SCM_PROMPT} ${normal}" + LAST_THEME_COLOR=${SCM_THEME_PROMPT_COLOR} + else + SCM_PROMPT="" + fi +} + +function powerline_cwd_prompt { +CWD_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${CWD_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}$(set_rgb_color - ${CWD_THEME_PROMPT_COLOR}) $(_swd)${normal}$(set_rgb_color ${CWD_THEME_PROMPT_COLOR} -)${normal}" + LAST_THEME_COLOR=${CWD_THEME_PROMPT_COLOR} +} + +function powerline_last_status_prompt { + if [[ "$1" -eq 0 ]]; then + LAST_STATUS_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} -)${THEME_PROMPT_SEPARATOR}${normal}" + else + LAST_STATUS_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${LAST_STATUS_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${LAST_STATUS_THEME_PROMPT_COLOR}) ${LAST_STATUS} ${normal}$(set_rgb_color ${LAST_STATUS_THEME_PROMPT_COLOR} -)${THEME_PROMPT_SEPARATOR}${normal}" + fi +} + +function powerline_prompt_command() { + local LAST_STATUS="$?" + + powerline_shell_prompt + powerline_virtualenv_prompt + powerline_scm_prompt + powerline_cwd_prompt + powerline_last_status_prompt LAST_STATUS + + PS1="${SHELL_PROMPT}${VIRTUALENV_PROMPT}${SCM_PROMPT}${CWD_PROMPT}${LAST_STATUS_PROMPT} " +} + +PROMPT_COMMAND=powerline_prompt_command + From 9b07aa85d6fc835edbf908b432de9dac1e07972d Mon Sep 17 00:00:00 2001 From: guneysus Date: Sun, 25 Jan 2015 12:17:03 +0200 Subject: [PATCH 002/123] small mods --- themes/powerturk/powerturk.theme.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/powerturk/powerturk.theme.bash b/themes/powerturk/powerturk.theme.bash index ccda0b39..35404360 100644 --- a/themes/powerturk/powerturk.theme.bash +++ b/themes/powerturk/powerturk.theme.bash @@ -35,7 +35,7 @@ _collapsed_wd() { binmode STDIN, ':encoding(UTF-8)'; binmode STDOUT, ':encoding(UTF-8)'; }; s|^$HOME||g; s|/([^/])[^/]*(?=/)|/\$1|g") | \ - sed -re "s/\//  /g" + sed -re "s/\//  /g" } _swd(){ @@ -70,7 +70,7 @@ _swd(){ for ((i=${#current}-2; i>=0; i--)); do subcurrent="${current:0:i}" - matching=("$begin/$subcurrent"*) # Array of all files that start with $subcurrent. + matching=("$begin/$subcurrent"*) # Array of all files that start with $subcurrent. (( ${#matching[*]} != 1 )) && break # Stop shortening if more than one file matches. shortcur="$subcurrent" shortcurstar="$subcurrent*" @@ -157,7 +157,7 @@ function powerline_scm_prompt { } function powerline_cwd_prompt { -CWD_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${CWD_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}$(set_rgb_color - ${CWD_THEME_PROMPT_COLOR}) $(_swd)${normal}$(set_rgb_color ${CWD_THEME_PROMPT_COLOR} -)${normal}" +CWD_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${CWD_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}$(set_rgb_color 0 ${CWD_THEME_PROMPT_COLOR}) $(_swd)${normal}$(set_rgb_color ${CWD_THEME_PROMPT_COLOR} -)${normal}" LAST_THEME_COLOR=${CWD_THEME_PROMPT_COLOR} } From d376c47bf3e8122b3a391b2be5bf843c524bf441 Mon Sep 17 00:00:00 2001 From: Ari Mourao Date: Wed, 19 Apr 2017 13:30:41 -0300 Subject: [PATCH 003/123] Added alias to 'git commit -a -m' --- 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 eb3554be..2fe26b12 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -38,6 +38,7 @@ alias gc='git commit -v' alias gca='git commit -v -a' alias gcm='git commit -v -m' alias gci='git commit --interactive' +alias gcam='git commit -a -m' alias gb='git branch' alias gba='git branch -a' alias gbt='git branch --track' From 3eb5e037f940861f20cda1d0b5cb7dda4c5f8f22 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Tue, 6 Feb 2018 03:32:08 -0600 Subject: [PATCH 004/123] GH-1140 add safe usage of SCM variable --- themes/base.theme.bash | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index a18c3729..f9144e54 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -79,10 +79,10 @@ 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_HG ]]; then SCM_CHAR=$SCM_HG_CHAR - elif [[ $SCM == $SCM_SVN ]]; then SCM_CHAR=$SCM_SVN_CHAR + if [[ -z ${SCM:-} ]]; then scm; fi + if [[ ${SCM:-} == $SCM_GIT ]]; then SCM_CHAR=$SCM_GIT_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 } @@ -92,9 +92,9 @@ function scm_prompt_vars { scm_prompt_char SCM_DIRTY=0 SCM_STATE='' - [[ $SCM == $SCM_GIT ]] && git_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_HG ]] && hg_prompt_vars && return + [[ ${SCM:-} == $SCM_SVN ]] && svn_prompt_vars && return } function scm_prompt_info { @@ -113,7 +113,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 @@ -125,8 +125,8 @@ function scm_prompt_info_common { fi # TODO: consider adding minimal status information for hg and svn - [[ ${SCM} == ${SCM_HG} ]] && hg_prompt_info && return - [[ ${SCM} == ${SCM_SVN} ]] && svn_prompt_info && return + [[ ${SCM:-} == ${SCM_HG} ]] && hg_prompt_info && return + [[ ${SCM:-} == ${SCM_SVN} ]] && svn_prompt_info && return } function git_prompt_minimal_info { From f5c483cfaae9721bae5070e4d5eea571ccab921e Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Tue, 6 Feb 2018 11:27:28 -0600 Subject: [PATCH 005/123] GH-1140 add additional uninitialized variable coverage --- themes/githelpers.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/githelpers.theme.bash b/themes/githelpers.theme.bash index e6bda810..66279faf 100644 --- a/themes/githelpers.theme.bash +++ b/themes/githelpers.theme.bash @@ -72,7 +72,7 @@ function _git-hide-status { function _git-status { [[ "${SCM_GIT_IGNORE_UNTRACKED}" = "true" ]] && local git_status_flags='-uno' - git status --porcelain ${git_status_flags} 2> /dev/null + git status --porcelain ${git_status_flags:-} 2> /dev/null } function _git-status-counts { From 353cb210d4bf03db4ecb86985ca54cf3c643ee5c Mon Sep 17 00:00:00 2001 From: Shashank Bharadwaj Date: Wed, 14 Feb 2018 10:54:20 -0800 Subject: [PATCH 006/123] 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 007/123] 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 008/123] 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 009/123] 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 010/123] 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 011/123] 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 012/123] 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 013/123] 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 014/123] 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 015/123] 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 016/123] 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 017/123] 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 018/123] 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 019/123] 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 020/123] 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 021/123] 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 022/123] 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 023/123] 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 024/123] 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 025/123] 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 026/123] 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 027/123] 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 028/123] 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 029/123] 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 d79db3b7e38780ddb0cacce45a6f155a6ab2daf0 Mon Sep 17 00:00:00 2001 From: Yukino Song Date: Tue, 10 Apr 2018 17:12:22 +0800 Subject: [PATCH 030/123] 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 a9d75c12a00aedd7a856844b522215432b284b4a Mon Sep 17 00:00:00 2001 From: Yukino Song Date: Wed, 11 Apr 2018 14:59:56 +0800 Subject: [PATCH 031/123] 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 cd983294ec3a362f1985e7e8dbd22fd6c2cb48ff Mon Sep 17 00:00:00 2001 From: Florian Molitorisz Date: Wed, 11 Apr 2018 17:37:29 +0200 Subject: [PATCH 032/123] 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 b1dbf2f7e095fcbbba8cfc712ab1ca9d3402b739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Rogo=C5=BCa?= Date: Sat, 14 Apr 2018 00:49:20 +0200 Subject: [PATCH 033/123] Added additional parameter for bash-it: reload Added creating an alias if command does not exist --- bash_it.sh | 18 +++++++++--------- completion/available/bash-it.completion.bash | 4 ++-- lib/additionals.bash | 16 ++++++++++++++++ lib/helpers.bash | 7 +++++-- 4 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 lib/additionals.bash diff --git a/bash_it.sh b/bash_it.sh index 6e87100d..6b4be1b5 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -1,15 +1,15 @@ #!/usr/bin/env bash # Initialize Bash It -# Reload Library -case $OSTYPE in - darwin*) - alias reload='source ~/.bash_profile' - ;; - *) - alias reload='source ~/.bashrc' - ;; -esac +# Reload Library, replaced by lib/additionals.bash +# case $OSTYPE in +# darwin*) +# alias reload='source ~/.bash_profile' +# ;; +# *) +# alias reload='source ~/.bashrc' +# ;; +# esac # Only set $BASH_IT if it's not already set if [ -z "$BASH_IT" ]; diff --git a/completion/available/bash-it.completion.bash b/completion/available/bash-it.completion.bash index 20a94e5b..914c81b7 100644 --- a/completion/available/bash-it.completion.bash +++ b/completion/available/bash-it.completion.bash @@ -65,7 +65,7 @@ _bash-it-comp() prev="${COMP_WORDS[COMP_CWORD-1]}" chose_opt="${COMP_WORDS[1]}" file_type="${COMP_WORDS[2]}" - opts="disable enable help migrate search show update version" + opts="disable enable help migrate search show update version reload" case "${chose_opt}" in show) local show_args="aliases completions plugins" @@ -82,7 +82,7 @@ _bash-it-comp() return 0 fi ;; - update | search | migrate | version) + update | search | migrate | version | reload) return 0 ;; enable | disable) diff --git a/lib/additionals.bash b/lib/additionals.bash new file mode 100644 index 00000000..f44c017a --- /dev/null +++ b/lib/additionals.bash @@ -0,0 +1,16 @@ +_bash-it-additional-reload() { + _about 'reloads ~/.bashrc' + + case $OSTYPE in + darwin*) + source ~/.bash_profile + ;; + *) + source ~/.bashrc + ;; + esac +} + +if ! command -v reload 1>/dev/null; then + alias reload=_bash-it-additional-reload +fi diff --git a/lib/helpers.bash b/lib/helpers.bash index 9693ea1a..658ffd0e 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -96,8 +96,7 @@ bash-it () version) func=_bash-it-version;; *) - reference bash-it - return;; + func=_bash-it-additional-$verb $component "$@" esac # pluralize component if necessary @@ -107,6 +106,10 @@ bash-it () else if _is_function ${func}es; then func=${func}es + elif [[ $func =~ ^_bash-it-additional- ]]; then + echo "oops! $verb is not valid additional command" + reference bash-it + return else echo "oops! $component is not a valid option!" reference bash-it From 89d1661d2393cee0a2b9af33b14aae99b2098fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Rogo=C5=BCa?= Date: Tue, 17 Apr 2018 23:48:33 +0200 Subject: [PATCH 034/123] Replaced reload section with proper function. Added completion for reload. Fixed order in completion Added unit tests for completion The variable BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE has to be unset. --- bash_it.sh | 10 ------- completion/available/bash-it.completion.bash | 4 +-- lib/additionals.bash | 16 ----------- lib/composure.bash | 2 +- lib/helpers.bash | 28 +++++++++++++++----- test/completion/bash-it.completion.bats | 12 ++++----- test/lib/composure.bats | 2 +- test/test_helper.bash | 1 + 8 files changed, 33 insertions(+), 42 deletions(-) delete mode 100644 lib/additionals.bash diff --git a/bash_it.sh b/bash_it.sh index 6b4be1b5..d85579a4 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -1,16 +1,6 @@ #!/usr/bin/env bash # Initialize Bash It -# Reload Library, replaced by lib/additionals.bash -# case $OSTYPE in -# darwin*) -# alias reload='source ~/.bash_profile' -# ;; -# *) -# alias reload='source ~/.bashrc' -# ;; -# esac - # Only set $BASH_IT if it's not already set if [ -z "$BASH_IT" ]; then diff --git a/completion/available/bash-it.completion.bash b/completion/available/bash-it.completion.bash index 914c81b7..71ec8418 100644 --- a/completion/available/bash-it.completion.bash +++ b/completion/available/bash-it.completion.bash @@ -65,7 +65,7 @@ _bash-it-comp() prev="${COMP_WORDS[COMP_CWORD-1]}" chose_opt="${COMP_WORDS[1]}" file_type="${COMP_WORDS[2]}" - opts="disable enable help migrate search show update version reload" + opts="disable enable help migrate reload search show update version" case "${chose_opt}" in show) local show_args="aliases completions plugins" @@ -82,7 +82,7 @@ _bash-it-comp() return 0 fi ;; - update | search | migrate | version | reload) + migrate | reload | search | update | version) return 0 ;; enable | disable) diff --git a/lib/additionals.bash b/lib/additionals.bash deleted file mode 100644 index f44c017a..00000000 --- a/lib/additionals.bash +++ /dev/null @@ -1,16 +0,0 @@ -_bash-it-additional-reload() { - _about 'reloads ~/.bashrc' - - case $OSTYPE in - darwin*) - source ~/.bash_profile - ;; - *) - source ~/.bashrc - ;; - esac -} - -if ! command -v reload 1>/dev/null; then - alias reload=_bash-it-additional-reload -fi diff --git a/lib/composure.bash b/lib/composure.bash index 5ef7104c..c05f8ed0 100644 --- a/lib/composure.bash +++ b/lib/composure.bash @@ -10,7 +10,7 @@ composure_keywords () { - echo "about author example group param version" + echo "about author example group param reload version" } letterpress () diff --git a/lib/helpers.bash b/lib/helpers.bash index 658ffd0e..e80c8459 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -61,7 +61,7 @@ function reload_plugins() { bash-it () { about 'Bash-it help and maintenance' - param '1: verb [one of: help | show | enable | disable | migrate | update | search | version ] ' + param '1: verb [one of: help | show | enable | disable | migrate | update | search | version | reload ] ' param '2: component type [one of: alias(es) | completion(s) | plugin(s) ] or search term(s)' param '3: specific component [optional]' example '$ bash-it show plugins' @@ -72,6 +72,7 @@ bash-it () example '$ bash-it update' example '$ bash-it search ruby [[-]rake]... [--enable | --disable]' example '$ bash-it version' + example '$ bash-it reload' typeset verb=${1:-} shift typeset component=${1:-} @@ -95,8 +96,11 @@ bash-it () func=_bash-it-migrate;; version) func=_bash-it-version;; + reload) + func=_bash-it-reload;; *) - func=_bash-it-additional-$verb $component "$@" + reference bash-it + return;; esac # pluralize component if necessary @@ -106,10 +110,6 @@ bash-it () else if _is_function ${func}es; then func=${func}es - elif [[ $func =~ ^_bash-it-additional- ]]; then - echo "oops! $verb is not valid additional command" - reference bash-it - return else echo "oops! $component is not a valid option!" reference bash-it @@ -256,6 +256,22 @@ _bash-it-version() { cd - &> /dev/null || return } +_bash-it-reload() { + _about 'reloads a profile file' + _group 'lib' + + cd "${BASH_IT}" || return + + case $OSTYPE in + darwin*) + source ~/.bash_profile + ;; + *) + source ~/.bashrc + ;; + esac +} + _bash-it-describe () { _about 'summarizes available bash_it components' diff --git a/test/completion/bash-it.completion.bats b/test/completion/bash-it.completion.bats index 3cdc84ba..f35b180b 100644 --- a/test/completion/bash-it.completion.bats +++ b/test/completion/bash-it.completion.bats @@ -99,32 +99,32 @@ function __check_completion () { @test "completion bash-it: show options" { run __check_completion 'bash-it ' - assert_line -n 0 "disable enable help migrate search show update version" + assert_line -n 0 "disable enable help migrate reload search show update version" } @test "completion bash-it: bash-ti - show options" { run __check_completion 'bash-ti ' - assert_line -n 0 "disable enable help migrate search show update version" + assert_line -n 0 "disable enable help migrate reload search show update version" } @test "completion bash-it: shit - show options" { run __check_completion 'shit ' - assert_line -n 0 "disable enable help migrate search show update version" + assert_line -n 0 "disable enable help migrate reload search show update version" } @test "completion bash-it: bashit - show options" { run __check_completion 'bashit ' - assert_line -n 0 "disable enable help migrate search show update version" + assert_line -n 0 "disable enable help migrate reload search show update version" } @test "completion bash-it: batshit - show options" { run __check_completion 'batshit ' - assert_line -n 0 "disable enable help migrate search show update version" + assert_line -n 0 "disable enable help migrate reload search show update version" } @test "completion bash-it: bash_it - show options" { run __check_completion 'bash_it ' - assert_line -n 0 "disable enable help migrate search show update version" + assert_line -n 0 "disable enable help migrate reload search show update version" } @test "completion bash-it: show - show options" { diff --git a/test/lib/composure.bats b/test/lib/composure.bats index af4bc8cf..7ba88853 100755 --- a/test/lib/composure.bats +++ b/test/lib/composure.bats @@ -5,5 +5,5 @@ load ../../lib/composure @test "lib composure: composure_keywords()" { run composure_keywords - assert_output "about author example group param version" + assert_output "about author example group param reload version" } diff --git a/test/test_helper.bash b/test/test_helper.bash index e2bb9442..9784cdf8 100644 --- a/test/test_helper.bash +++ b/test/test_helper.bash @@ -4,6 +4,7 @@ unset NGINX_PATH unset IRC_CLIENT unset TODO unset SCM_CHECK +unset BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE BASH_IT_TEST_DIR="${BATS_TMPDIR}/.bash_it" From b538712dc302cefe472ba287fcb31dffd61623d3 Mon Sep 17 00:00:00 2001 From: Vangelis Tasoulas Date: Thu, 19 Apr 2018 18:34:00 +0200 Subject: [PATCH 035/123] 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 036/123] 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 037/123] 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 038/123] 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 039/123] 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 040/123] 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 48e6888a38eb30935318e3a458c76175bc058f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Rogo=C5=BCa?= Date: Sat, 21 Apr 2018 19:15:50 +0200 Subject: [PATCH 041/123] Removed reload keyword from composure_keywords(), it is not needed --- lib/composure.bash | 2 +- test/lib/composure.bats | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/composure.bash b/lib/composure.bash index c05f8ed0..5ef7104c 100644 --- a/lib/composure.bash +++ b/lib/composure.bash @@ -10,7 +10,7 @@ composure_keywords () { - echo "about author example group param reload version" + echo "about author example group param version" } letterpress () diff --git a/test/lib/composure.bats b/test/lib/composure.bats index 7ba88853..af4bc8cf 100755 --- a/test/lib/composure.bats +++ b/test/lib/composure.bats @@ -5,5 +5,5 @@ load ../../lib/composure @test "lib composure: composure_keywords()" { run composure_keywords - assert_output "about author example group param reload version" + assert_output "about author example group param version" } From 98c44fcc1e19b52d5824244594e60a622806e0a0 Mon Sep 17 00:00:00 2001 From: Ricardo Lima Date: Sat, 21 Apr 2018 21:55:42 -0400 Subject: [PATCH 042/123] 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 043/123] 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 b288ecbd2752ebbf2c56852f969658abb0dc7c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Rogo=C5=BCa?= Date: Wed, 25 Apr 2018 19:53:06 +0200 Subject: [PATCH 044/123] Added legacy alias reload: https://github.com/Bash-it/bash-it/issues/1120#issuecomment-354376835 --- bash_it.sh | 12 ++++++++++++ template/bash_profile.template.bash | 3 +++ 2 files changed, 15 insertions(+) diff --git a/bash_it.sh b/bash_it.sh index d85579a4..2d085e9d 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -102,5 +102,17 @@ then . "$HOME/.jekyllconfig" fi +# BASH_IT_RELOAD_LEGACY is set. +if ! command -v reload &>/dev/null && [ -n "$BASH_IT_RELOAD_LEGACY" ]; then + case $OSTYPE in + darwin*) + alias reload='source ~/.bash_profile' + ;; + *) + alias reload='source ~/.bashrc' + ;; + esac +fi + # Disable trap DEBUG on subshells - https://github.com/Bash-it/bash-it/pull/1040 set +T diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index a052e91e..01097960 100755 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -48,5 +48,8 @@ export SCM_CHECK=true # after enabling or disabling aliases, plugins, and completions. # export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=1 +# Uncomment this to make Bash-it create alias reload. +# export BASH_IT_RELOAD_LEGACY=1 + # Load Bash It source "$BASH_IT"/bash_it.sh From 209a55ab9fe03700daab250c3a76921ec589ec27 Mon Sep 17 00:00:00 2001 From: Ahmed Kamal Date: Wed, 25 Apr 2018 22:18:59 +0200 Subject: [PATCH 045/123] 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 046/123] 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 047/123] 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 048/123] 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 From 1a7ebf4da70b0fbcb6ec5d5e3da88f884c65d356 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Mon, 30 Apr 2018 13:40:08 -0500 Subject: [PATCH 049/123] change to setting variables to empty value before use --- themes/base.theme.bash | 6 +++++- themes/githelpers.theme.bash | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 2cc41643..12df1d8a 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -7,6 +7,8 @@ CLOCK_THEME_PROMPT_SUFFIX='' THEME_PROMPT_HOST='\H' +SCM= + SCM_CHECK=${SCM_CHECK:=true} SCM_THEME_PROMPT_DIRTY=' ✗' @@ -64,6 +66,8 @@ THEME_SHOW_USER_HOST=${THEME_SHOW_USER_HOST:=false} USER_HOST_THEME_PROMPT_PREFIX='' USER_HOST_THEME_PROMPT_SUFFIX='' +VIRTUAL_ENV= + VIRTUALENV_THEME_PROMPT_PREFIX=' |' VIRTUALENV_THEME_PROMPT_SUFFIX='|' @@ -122,7 +126,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 diff --git a/themes/githelpers.theme.bash b/themes/githelpers.theme.bash index 66279faf..833e5190 100644 --- a/themes/githelpers.theme.bash +++ b/themes/githelpers.theme.bash @@ -71,7 +71,8 @@ function _git-hide-status { } function _git-status { - [[ "${SCM_GIT_IGNORE_UNTRACKED}" = "true" ]] && local git_status_flags='-uno' + local git_status_flags= + [[ "${SCM_GIT_IGNORE_UNTRACKED}" = "true" ]] && git_status_flags='-uno' git status --porcelain ${git_status_flags:-} 2> /dev/null } @@ -102,7 +103,8 @@ function _git-status-counts { function _git-remote-info { [[ "$(_git-upstream)" == "" ]] && return - [[ "$(_git-branch)" == "$(_git-upstream-branch)" ]] && local same_branch_name=true + local same_branch_name= + [[ "$(_git-branch)" == "$(_git-upstream-branch)" ]] && same_branch_name=true if ([[ "${SCM_GIT_SHOW_REMOTE_INFO}" = "auto" ]] && [[ "$(_git-num-remotes)" -ge 2 ]]) || [[ "${SCM_GIT_SHOW_REMOTE_INFO}" = "true" ]]; then if [[ "${same_branch_name}" != "true" ]]; then From 3bb21ba1e9feaa90aebde84fd550575801aa694f Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Mon, 30 Apr 2018 13:43:16 -0500 Subject: [PATCH 050/123] removed unneeded default value --- themes/githelpers.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/githelpers.theme.bash b/themes/githelpers.theme.bash index 833e5190..1f43382d 100644 --- a/themes/githelpers.theme.bash +++ b/themes/githelpers.theme.bash @@ -73,7 +73,7 @@ function _git-hide-status { function _git-status { local git_status_flags= [[ "${SCM_GIT_IGNORE_UNTRACKED}" = "true" ]] && git_status_flags='-uno' - git status --porcelain ${git_status_flags:-} 2> /dev/null + git status --porcelain ${git_status_flags} 2> /dev/null } function _git-status-counts { From cfab5eeac53bd68e7831a597792ceee9657cf00b Mon Sep 17 00:00:00 2001 From: Jason Yu Date: Tue, 1 May 2018 09:53:15 +0100 Subject: [PATCH 051/123] Update git.aliases.bash --- 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 51717f40..169fe7b8 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -30,6 +30,7 @@ alias gup='git fetch && git rebase' alias gp='git push' alias gpo='git push origin' alias gpu='git push --set-upstream' +alias gpuo='git push --set-upstream origin' alias gpom='git push origin master' alias gr='git remote' alias grv='git remote -v' From 094c8464643e78f79d49e82d4b45cb1b9595798a Mon Sep 17 00:00:00 2001 From: madcarrot <8383zhe@gmail.com> Date: Sun, 13 May 2018 16:35:34 -0400 Subject: [PATCH 052/123] Update powerline-multiline.base.bash --- themes/powerline-multiline/powerline-multiline.base.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/themes/powerline-multiline/powerline-multiline.base.bash b/themes/powerline-multiline/powerline-multiline.base.bash index b78f5b74..b92e5c8c 100644 --- a/themes/powerline-multiline/powerline-multiline.base.bash +++ b/themes/powerline-multiline/powerline-multiline.base.bash @@ -51,6 +51,8 @@ function __powerline_prompt_command { local info="$(__powerline_${segment}_prompt)" [[ -n "${info}" ]] && __powerline_right_segment "${info}" done + RIGHT_PAD=$(printf "%.s " $(seq 1 $RIGHT_PROMPT_LENGTH)) + LEFT_PROMPT+="${RIGHT_PAD}${move_cursor_rightmost}" LEFT_PROMPT+="\033[${RIGHT_PROMPT_LENGTH}D" fi From ecdf6af08d1a586991e4985dc39c1364dcbe8194 Mon Sep 17 00:00:00 2001 From: madcarrot <8383zhe@gmail.com> Date: Tue, 15 May 2018 16:22:41 -0400 Subject: [PATCH 053/123] Update powerline-multiline.base.bash --- themes/powerline-multiline/powerline-multiline.base.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/powerline-multiline/powerline-multiline.base.bash b/themes/powerline-multiline/powerline-multiline.base.bash index b92e5c8c..ac442f73 100644 --- a/themes/powerline-multiline/powerline-multiline.base.bash +++ b/themes/powerline-multiline/powerline-multiline.base.bash @@ -46,7 +46,7 @@ function __powerline_prompt_command { ## right prompt ## if [[ -n "${POWERLINE_RIGHT_PROMPT}" ]]; then - LEFT_PROMPT+="${move_cursor_rightmost}" + # LEFT_PROMPT+="${move_cursor_rightmost}" for segment in $POWERLINE_RIGHT_PROMPT; do local info="$(__powerline_${segment}_prompt)" [[ -n "${info}" ]] && __powerline_right_segment "${info}" From 9571c11ad0fb7afa8b5823b4cc5a295b9c3c8e64 Mon Sep 17 00:00:00 2001 From: "Brett A. Rogers" <14743+brogers@users.noreply.github.com> Date: Wed, 16 May 2018 14:58:59 -0400 Subject: [PATCH 054/123] Return to original directory after reload --- lib/helpers.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/helpers.bash b/lib/helpers.bash index e80c8459..e8fc19ba 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -270,6 +270,8 @@ _bash-it-reload() { source ~/.bashrc ;; esac + + cd - &> /dev/null || return } _bash-it-describe () From bca7051a62dfe788230d995f41a30b936509f8d0 Mon Sep 17 00:00:00 2001 From: Josh Marshall Date: Fri, 18 May 2018 11:52:35 +1000 Subject: [PATCH 055/123] Fix bold text issue The default text style was not being set back to normal so terminal output was rendering bold, e.g. for an ls command --- themes/candy/candy.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/candy/candy.theme.bash b/themes/candy/candy.theme.bash index f3f0abfc..60bde3cd 100644 --- a/themes/candy/candy.theme.bash +++ b/themes/candy/candy.theme.bash @@ -1,7 +1,7 @@ #!/usr/bin/env bash function prompt_command() { - PS1="${green}\u@\h $(clock_prompt) ${reset_color}${white}\w${reset_color}$(scm_prompt_info)${blue} →${bold_blue} ${reset_color} "; + PS1="${green}\u@\h $(clock_prompt) ${reset_color}${white}\w${reset_color}$(scm_prompt_info)${blue} →${bold_blue} ${reset_color} ${normal}"; } THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$blue"} From 9260e16278bd556810180d79c1f23c65cafd292e Mon Sep 17 00:00:00 2001 From: penguin2048 Date: Mon, 21 May 2018 22:56:14 +0530 Subject: [PATCH 056/123] Add elixr theme --- themes/elixr/elixr.theme.bash | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 themes/elixr/elixr.theme.bash diff --git a/themes/elixr/elixr.theme.bash b/themes/elixr/elixr.theme.bash new file mode 100644 index 00000000..79ef313f --- /dev/null +++ b/themes/elixr/elixr.theme.bash @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +SCM_THEME_PROMPT_DIRTY=" ${red}✗" +SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" +SCM_THEME_PROMPT_PREFIX=" ${green}| " +SCM_THEME_PROMPT_SUFFIX="${green} |" +SCM_NONE_CHAR='◐ ' +SCM_GIT_SHOW_MINIMAL_INFO=true +GIT_THEME_PROMPT_DIRTY=" ${red}✗" +GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" +GIT_THEME_PROMPT_PREFIX=" ${green}|" +GIT_THEME_PROMPT_SUFFIX="${green}|" + +RVM_THEME_PROMPT_PREFIX="|" +RVM_THEME_PROMPT_SUFFIX=" d|" + +BOLD="\[\e[1m\]" + +function prompt_command() { + PS1="\n${bold_cyan}$(scm_prompt_char_info) ${bold_cyan}\w :${reset_color}${normal}${bold} " +} + +safe_append_prompt_command prompt_command From badc3beddfe3da239f9ed07a8245c817598373a7 Mon Sep 17 00:00:00 2001 From: penguin2048 Date: Mon, 21 May 2018 23:09:09 +0530 Subject: [PATCH 057/123] Add bold text in elixr theme --- themes/elixr/elixr.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/elixr/elixr.theme.bash b/themes/elixr/elixr.theme.bash index 79ef313f..0e37f94c 100644 --- a/themes/elixr/elixr.theme.bash +++ b/themes/elixr/elixr.theme.bash @@ -17,7 +17,7 @@ RVM_THEME_PROMPT_SUFFIX=" d|" BOLD="\[\e[1m\]" function prompt_command() { - PS1="\n${bold_cyan}$(scm_prompt_char_info) ${bold_cyan}\w :${reset_color}${normal}${bold} " + PS1="\n${bold_cyan}$(scm_prompt_char_info) ${bold_cyan}\w :${reset_color}${normal}${BOLD} " } safe_append_prompt_command prompt_command From 0028dc7661870954e6042305ce7a5bff9d71779c Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Thu, 31 May 2018 17:57:09 +0200 Subject: [PATCH 058/123] Fixed indentation to two spaces, like in the rest of the file --- bash_it.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index 2d085e9d..4b70235f 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -4,18 +4,18 @@ # Only set $BASH_IT if it's not already set if [ -z "$BASH_IT" ]; then - # Setting $BASH to maintain backwards compatibility - # TODO: warn users that they should upgrade their .bash_profile - export BASH_IT=$BASH - export BASH="$(bash -c 'echo $BASH')" + # Setting $BASH to maintain backwards compatibility + # TODO: warn users that they should upgrade their .bash_profile + export BASH_IT=$BASH + export BASH="$(bash -c 'echo $BASH')" fi # For backwards compatibility, look in old BASH_THEME location if [ -z "$BASH_IT_THEME" ]; then - # TODO: warn users that they should upgrade their .bash_profile - export BASH_IT_THEME="$BASH_THEME"; - unset $BASH_THEME; + # TODO: warn users that they should upgrade their .bash_profile + export BASH_IT_THEME="$BASH_THEME"; + unset $BASH_THEME; fi # Load composure first, so we support function metadata @@ -81,7 +81,7 @@ done unset config_file if [[ $PROMPT ]]; then - export PS1="\[""$PROMPT""\]" + export PS1="\[""$PROMPT""\]" fi # Adding Support for other OSes From 5d99d6cb9bc1c6128b761b21ad6bf23039a4f2bb Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Thu, 31 May 2018 18:05:25 +0200 Subject: [PATCH 059/123] Fixed some shellcheck warnings Also fixed one broken case of `unset`. --- bash_it.sh | 13 +++++++------ uninstall.sh | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index 4b70235f..8eea4c6a 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -7,7 +7,8 @@ then # Setting $BASH to maintain backwards compatibility # TODO: warn users that they should upgrade their .bash_profile export BASH_IT=$BASH - export BASH="$(bash -c 'echo $BASH')" + BASH="$(bash -c 'echo $BASH')" + export BASH fi # For backwards compatibility, look in old BASH_THEME location @@ -15,7 +16,7 @@ if [ -z "$BASH_IT_THEME" ]; then # TODO: warn users that they should upgrade their .bash_profile export BASH_IT_THEME="$BASH_THEME"; - unset $BASH_THEME; + unset BASH_THEME; fi # Load composure first, so we support function metadata @@ -30,9 +31,9 @@ LIB="${BASH_IT}/lib/*.bash" APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash" for config_file in $LIB do - if [ $config_file != $APPEARANCE_LIB ]; then + if [ "$config_file" != "$APPEARANCE_LIB" ]; then # shellcheck disable=SC1090 - source $config_file + source "$config_file" fi done @@ -57,7 +58,7 @@ source "${BASH_IT}/themes/base.theme.bash" # appearance (themes) now, after all dependencies # shellcheck source=./lib/appearance.bash -source $APPEARANCE_LIB +source "$APPEARANCE_LIB" # Load custom aliases, completion, plugins for file_type in "aliases" "completion" "plugins" @@ -75,7 +76,7 @@ for config_file in $CUSTOM do if [ -e "${config_file}" ]; then # shellcheck disable=SC1090 - source $config_file + source "$config_file" fi done diff --git a/uninstall.sh b/uninstall.sh index 18d88e80..17712610 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -16,7 +16,7 @@ esac BACKUP_FILE=$CONFIG_FILE.bak if [ ! -e "$HOME/$BACKUP_FILE" ]; then - echo -e "\033[0;33mBackup file "$HOME/$BACKUP_FILE" not found.\033[0m" >&2 + echo -e "\033[0;33mBackup file $HOME/$BACKUP_FILE not found.\033[0m" >&2 test -w "$HOME/$CONFIG_FILE" && mv "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.uninstall" && From 6a5915d0d63ac163154284a535eabe1de34ab365 Mon Sep 17 00:00:00 2001 From: Norbu Tsering Date: Fri, 1 Jun 2018 01:17:03 -0400 Subject: [PATCH 060/123] Added norbu theme --- themes/norbu/norbu.theme.bash | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 themes/norbu/norbu.theme.bash diff --git a/themes/norbu/norbu.theme.bash b/themes/norbu/norbu.theme.bash new file mode 100644 index 00000000..184c13c9 --- /dev/null +++ b/themes/norbu/norbu.theme.bash @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +function set_prompt_symbol () { + if test $1 -eq 0 ; then + PROMPT_SYMBOL=">_" + else + PROMPT_SYMBOL="${orange}>_${normal}" + fi +} +function prompt_command() { + set_prompt_symbol $? + if test -z "$VIRTUAL_ENV" ; then + PYTHON_VIRTUALENV="" + else + PYTHON_VIRTUALENV="${bold_yellow}[`basename \"$VIRTUAL_ENV\"`]" + fi + + PS1="${bold_orange}${PYTHON_VIRTUALENV}${reset_color}${bold_green}[\w]${bold_blue}\[$(scm_prompt_info)\]${normal} \n${PROMPT_SYMBOL} " +} + +# scm themeing +SCM_THEME_PROMPT_DIRTY=" ✗" +SCM_THEME_PROMPT_CLEAN=" ✓" +SCM_THEME_PROMPT_PREFIX="[" +SCM_THEME_PROMPT_SUFFIX="]" + +safe_append_prompt_command prompt_command From 178c37140c5b98e648393316ddade7cac6b60051 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Fri, 1 Jun 2018 08:18:57 +0200 Subject: [PATCH 061/123] Updated theme preview documentation Fixes #1198 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c078699..022ce442 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,7 @@ export BASH_IT_THEME="powerline-multiline" export BASH_IT_THEME="/home/foo/my_theme/my_theme.theme.bash" ``` -You can easily preview the themes in your own shell using `BASH_PREVIEW=true reload`. +You can easily preview the themes in your own shell using `BASH_PREVIEW=true bash-it reload`. If you've created your own custom prompts, we'd love it if you shared with everyone else! Just submit a Pull Request. You can see theme screenshots on [wiki/Themes](https://github.com/Bash-it/bash-it/wiki/Themes). From a25ac59b849b3fac64feef5040c4c84ef50163ea Mon Sep 17 00:00:00 2001 From: Jonathan Barnes Date: Sun, 3 Jun 2018 10:06:25 -0700 Subject: [PATCH 062/123] Add `codeword` theme - Single line PS1 - Shares history in realtime among bash windows --- themes/codeword/README.md | 22 +++++++++++++++++ themes/codeword/codeword.theme.bash | 38 +++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 themes/codeword/README.md create mode 100644 themes/codeword/codeword.theme.bash diff --git a/themes/codeword/README.md b/themes/codeword/README.md new file mode 100644 index 00000000..38201dbf --- /dev/null +++ b/themes/codeword/README.md @@ -0,0 +1,22 @@ +# Single line PS1 theme w/realtime history among windows + + +Minimal theme overrides from bash_it base theming + + +## `user@host:path[virt-env][scm] $` +Breakdown of the segments: + +- **user@host:path** - *convienient for LAN based `ssh` and `scp` tasks* +- [**virtualenv**] - *only appears when activated* +- [**scm**] - *only appears when activated* +- **marker** - *$ or # depending on current user* + +### Examples + +```bash +user@example.lan:~ $ cd /tmp/foo/bar/baz +user@example.lan:/tmp/foo/bar/baz $ cd $HOME/workspace +user@example.lan:~/workspace $ cd sampleRepo/ +user@example.lan:~/workspace/sampleRepo [± |master ↑1 ↓3 {1} S:2 ?:1 ✗|] $ +``` diff --git a/themes/codeword/codeword.theme.bash b/themes/codeword/codeword.theme.bash new file mode 100644 index 00000000..96723ce3 --- /dev/null +++ b/themes/codeword/codeword.theme.bash @@ -0,0 +1,38 @@ +SCM_THEME_PROMPT_PREFIX=${SCM_THEME_PROMPT_SUFFIX} +SCM_THEME_PROMPT_DIRTY="${bold_red} ✗${normal}" +SCM_THEME_PROMPT_CLEAN="${bold_green} ✓${normal}" +SCM_GIT_CHAR="${green}±${normal}" + +scm_prompt() { + CHAR=$(scm_char) + if [ $CHAR = $SCM_NONE_CHAR ] + then + return + else + echo " [$(scm_char)$(scm_prompt_info)]" + fi +} + +mark_prompt() { + echo "${green}\$${normal}" +} + +user_host_path_prompt() { + ps_user="${green}\u${normal}"; + ps_host="${blue}\H${normal}"; + ps_path="${yellow}\w${normal}"; + echo "$ps_user@$ps_host:$ps_path" +} + +prompt() { + PS1="$(user_host_path_prompt)$(virtualenv_prompt)$(scm_prompt) $(mark_prompt) " +} + +share_history() { + history -a + history -c + history -r +} + +safe_append_prompt_command share_history +safe_append_prompt_command prompt From 8b0d752168720de25758df3db64b7267ce38cc22 Mon Sep 17 00:00:00 2001 From: Pablo Palazon Date: Mon, 11 Jun 2018 18:44:54 +0200 Subject: [PATCH 063/123] Add jgit-flow plugin --- plugins/available/jgitflow.plugin.bash | 47 ++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 plugins/available/jgitflow.plugin.bash diff --git a/plugins/available/jgitflow.plugin.bash b/plugins/available/jgitflow.plugin.bash new file mode 100644 index 00000000..a5b816ea --- /dev/null +++ b/plugins/available/jgitflow.plugin.bash @@ -0,0 +1,47 @@ +cite about-plugin +about-plugin 'Maven jgitflow build helpers' + +function hotfix-start { + about 'helper function for starting a new hotfix' + group 'jgitflow' + + mvn jgitflow:hotfix-start ${JGITFLOW_MVN_ARGUMENTS} +} + +function hotfix-finish { + about 'helper function for finishing a hotfix' + group 'jgitflow' + + mvn jgitflow:hotfix-finish -Darguments="${JGITFLOW_MVN_ARGUMENTS}" && git push && git push origin master && git push --tags +} + +function feature-start { + about 'helper function for starting a new feature' + group 'jgitflow' + + mvn jgitflow:feature-start ${JGITFLOW_MVN_ARGUMENTS} +} + +function feature-finish { + about 'helper function for finishing a feature' + group 'jgitflow' + + mvn jgitflow:feature-finish ${JGITFLOW_MVN_ARGUMENTS} + echo -e '\033[32m----------------------------------------------------------------\033[0m' + echo -e '\033[32m===== REMEMBER CREATE A NEW RELEASE FOR DEPLOY THIS FEATURE ====\033[0m' + echo -e '\033[32m----------------------------------------------------------------\033[0m' +} + +function release-start { + about 'helper function for starting a new release' + group 'jgitflow' + + mvn jgitflow:release-start ${JGITFLOW_MVN_ARGUMENTS} +} + +function release-finish { + about 'helper function for finishing a release' + group 'jgitflow' + + mvn jgitflow:release-finish -Darguments="${JGITFLOW_MVN_ARGUMENTS}" && git push && git push origin master && git push --tags +} From 5387aa025dbeacfee8f726555ad2d6805372559c Mon Sep 17 00:00:00 2001 From: Pablo Palazon Date: Thu, 14 Jun 2018 09:22:45 +0200 Subject: [PATCH 064/123] Corrected grammatical errors --- plugins/available/jgitflow.plugin.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/available/jgitflow.plugin.bash b/plugins/available/jgitflow.plugin.bash index a5b816ea..83ee8a23 100644 --- a/plugins/available/jgitflow.plugin.bash +++ b/plugins/available/jgitflow.plugin.bash @@ -28,7 +28,7 @@ function feature-finish { mvn jgitflow:feature-finish ${JGITFLOW_MVN_ARGUMENTS} echo -e '\033[32m----------------------------------------------------------------\033[0m' - echo -e '\033[32m===== REMEMBER CREATE A NEW RELEASE FOR DEPLOY THIS FEATURE ====\033[0m' + echo -e '\033[32m===== REMEMBER TO CREATE A NEW RELEASE TO DEPLOY THIS FEATURE ====\033[0m' echo -e '\033[32m----------------------------------------------------------------\033[0m' } From 0936e2a0297e4e395d8832bccb0c1d7e3a326b0d Mon Sep 17 00:00:00 2001 From: con-f-use Date: Tue, 26 Jun 2018 13:08:25 +0200 Subject: [PATCH 065/123] Fix wildcards and handle includes in ssh complete Handle includes in `.ssh/config` and fix bug that caused `Host` entries with wildcards in them to be included in the autocomplete suggestions. --- completion/available/ssh.completion.bash | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/completion/available/ssh.completion.bash b/completion/available/ssh.completion.bash index b54202bd..234a6958 100644 --- a/completion/available/ssh.completion.bash +++ b/completion/available/ssh.completion.bash @@ -11,11 +11,16 @@ _sshcomplete() { local OPTIONS=" -- ${CURRENT_PROMPT}" fi - - # parse all defined hosts from .ssh/config - if [ -r "$HOME/.ssh/config" ]; then - COMPREPLY=($(compgen -W "$(grep -i ^Host "$HOME/.ssh/config" | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) ) - fi + # parse all defined hosts from .ssh/config and files included there + for fl in "$HOME/.ssh/config" \ + $(grep -P "^\s*Include" "$HOME/.ssh/config" | + awk '{for (i=2; i<=NF; i++) print $i}' | + sed "s|^~/|$HOME/|") + do + if [ -r "$fl" ]; then + COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$(grep -i ^Host "$fl" |grep -v '[*!]' | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) ) + fi + done # parse all hosts found in .ssh/known_hosts if [ -r "$HOME/.ssh/known_hosts" ]; then From 6eb35644e6c6009c88454c7ca7cfbecdd856b037 Mon Sep 17 00:00:00 2001 From: Adam Wallis Date: Mon, 9 Jul 2018 21:53:27 +0000 Subject: [PATCH 066/123] Add powerline initialization plugin Initializes powerline per the official powerline documentation: https://powerline.readthedocs.io/en/master/usage/shell-prompts.html#bash-prompt --- plugins/available/powerline.plugin.bash | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plugins/available/powerline.plugin.bash diff --git a/plugins/available/powerline.plugin.bash b/plugins/available/powerline.plugin.bash new file mode 100644 index 00000000..8e148f1e --- /dev/null +++ b/plugins/available/powerline.plugin.bash @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +cite about-plugin +about-plugin 'enables powerline daemon' + +command -v powerline-daemon &>/dev/null || return +powerline-daemon -q +POWERLINE_BASH_CONTINUATION=1 +POWERLINE_BASH_SELECT=1 +bashPowerlineInit=$(python -c \ + "import os; \ + import powerline;\ + print(os.path.join(os.path.dirname(\ + powerline.__file__),\ + 'bindings', \ + 'bash', \ + 'powerline.sh'))") +[ -e $bashPowerlineInit ] || return +. $bashPowerlineInit From 1a81ca8b8dd3ce086eb5e3daf95ba813fc37b1a4 Mon Sep 17 00:00:00 2001 From: Adam Wallis Date: Mon, 9 Jul 2018 22:14:17 +0000 Subject: [PATCH 067/123] Don't redefine powerline theme functions In the case where a powerline theme is enabled in bash-it, it seems prudent to avoid touching any of these functions. --- plugins/available/powerline.plugin.bash | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/available/powerline.plugin.bash b/plugins/available/powerline.plugin.bash index 8e148f1e..0388aa37 100644 --- a/plugins/available/powerline.plugin.bash +++ b/plugins/available/powerline.plugin.bash @@ -5,6 +5,13 @@ about-plugin 'enables powerline daemon' command -v powerline-daemon &>/dev/null || return powerline-daemon -q + +#the following should not be executed if bashit powerline themes in use +case "$BASH_IT_THEME" in + *powerline*) + return + ;; +esac POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_SELECT=1 bashPowerlineInit=$(python -c \ From f484fadbb194d8db9a1b62b512b4a61e8a756ab3 Mon Sep 17 00:00:00 2001 From: Piotr Rogoza Date: Thu, 12 Jul 2018 06:32:11 +0000 Subject: [PATCH 068/123] The function _git-hide-status is invoked to late --- themes/base.theme.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index fda845de..67fa7fa0 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -389,6 +389,7 @@ function user_host_prompt { # backwards-compatibility function git_prompt_info { + _git-hide-status && return git_prompt_vars echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}" } From af16e9e68b78be9b439f708792dd1b9bea7695f2 Mon Sep 17 00:00:00 2001 From: Gabriel Smadi Date: Sat, 14 Jul 2018 20:39:19 -0400 Subject: [PATCH 069/123] Display only first line of Python 3.7 version --- themes/base.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 12df1d8a..cc56bdff 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -347,7 +347,7 @@ function condaenv_prompt { } function py_interp_prompt { - py_version=$(python --version 2>&1 | awk '{print "py-"$2;}') || return + 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}" } From 5ea271a956636caf48391c5c45c08c56693b16c8 Mon Sep 17 00:00:00 2001 From: Yuri V Date: Tue, 17 Jul 2018 17:07:58 +0300 Subject: [PATCH 070/123] =?UTF-8?q?changet=20ruby=20symbol=20to=20?= =?UTF-8?q?=F0=9F=92=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/powerline-plain/powerline-plain.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash index ce7943c7..53da88b4 100644 --- a/themes/powerline-plain/powerline-plain.theme.bash +++ b/themes/powerline-plain/powerline-plain.theme.bash @@ -25,7 +25,7 @@ RVM_THEME_PROMPT_SUFFIX="" RBENV_THEME_PROMPT_PREFIX="" RBENV_THEME_PROMPT_SUFFIX="" RUBY_THEME_PROMPT_COLOR=161 -RUBY_CHAR=${POWERLINE_RUBY_CHAR:="ⓔ "} +RUBY_CHAR=${POWERLINE_RUBY_CHAR:="💎 "} CWD_THEME_PROMPT_COLOR=240 From e8c3237fb4c485139373ac3aeeb649522c0ba63c Mon Sep 17 00:00:00 2001 From: Adam Wallis Date: Tue, 17 Jul 2018 10:56:36 -0400 Subject: [PATCH 071/123] Use fd for fzf if available on system fd is orders of magnitude faster when searching for files. This patch will force fzf to use fd instead of find. This change is implemented per the recommendation: https://github.com/junegunn/fzf#environment-variables --- plugins/available/fzf.plugin.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/available/fzf.plugin.bash b/plugins/available/fzf.plugin.bash index 69775c75..5aacc37d 100644 --- a/plugins/available/fzf.plugin.bash +++ b/plugins/available/fzf.plugin.bash @@ -6,6 +6,8 @@ about-plugin 'load fzf, if you are using it' [ -f ~/.fzf.bash ] && source ~/.fzf.bash +command -v fd &> /dev/null && export FZF_DEFAULT_COMMAND='fd --type f' + fe() { about "Open the selected file in the default editor" group "fzf" From dd081b6e5f62eb539fd637a956db7d7336d8e72d Mon Sep 17 00:00:00 2001 From: Adam Wallis Date: Tue, 17 Jul 2018 13:52:59 -0400 Subject: [PATCH 072/123] Add plugin for 'jump' Considering FASD has been deprecated, jump does the same thing but is actively maintained! https://github.com/gsamokovarov/jump --- plugins/available/jump.plugin.bash | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 plugins/available/jump.plugin.bash diff --git a/plugins/available/jump.plugin.bash b/plugins/available/jump.plugin.bash new file mode 100755 index 00000000..c7b38d28 --- /dev/null +++ b/plugins/available/jump.plugin.bash @@ -0,0 +1,14 @@ +cite about-plugin +about-plugin 'initialize jump (see https://github.com/gsamokovarov/jump)' + +__init_jump() { + command -v jump &> /dev/null + if [ $? -eq 1 ]; then + echo -e "You must install jump before you can use this plugin" + echo -e "See: https://github.com/gsamokovarov/jump" + else + eval "$(jump shell --bind=z)" + fi +} + +__init_jump From e23d26c8fe95911ec3b0c2ce1121ac3be6b02b4f Mon Sep 17 00:00:00 2001 From: con-f-use Date: Wed, 18 Jul 2018 14:52:01 +0200 Subject: [PATCH 073/123] Fix #1210 grep error on MacOS with ssh completion See #1210 --- completion/available/ssh.completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/completion/available/ssh.completion.bash b/completion/available/ssh.completion.bash index 234a6958..d5cd6e61 100644 --- a/completion/available/ssh.completion.bash +++ b/completion/available/ssh.completion.bash @@ -13,7 +13,7 @@ _sshcomplete() { # parse all defined hosts from .ssh/config and files included there for fl in "$HOME/.ssh/config" \ - $(grep -P "^\s*Include" "$HOME/.ssh/config" | + $(grep "^\s*Include" "$HOME/.ssh/config" | awk '{for (i=2; i<=NF; i++) print $i}' | sed "s|^~/|$HOME/|") do From ac42a6233c2e620e35090de53e000125be17264b Mon Sep 17 00:00:00 2001 From: Adam Wallis Date: Wed, 18 Jul 2018 09:52:52 -0400 Subject: [PATCH 074/123] Allow jump plugin to fail silently when jump not installed Per recommendations from @nwinkler, allow the jump test to fail silently. This helps in cases where users are SSH'ing in, or for some other reason are using bash-it environment on a foreign machine. --- plugins/available/jump.plugin.bash | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/available/jump.plugin.bash b/plugins/available/jump.plugin.bash index c7b38d28..bc6f85e1 100755 --- a/plugins/available/jump.plugin.bash +++ b/plugins/available/jump.plugin.bash @@ -2,13 +2,8 @@ cite about-plugin about-plugin 'initialize jump (see https://github.com/gsamokovarov/jump)' __init_jump() { - command -v jump &> /dev/null - if [ $? -eq 1 ]; then - echo -e "You must install jump before you can use this plugin" - echo -e "See: https://github.com/gsamokovarov/jump" - else - eval "$(jump shell --bind=z)" - fi + command -v jump &> /dev/null || return + eval "$(jump shell --bind=z)" } __init_jump From 03e26ef7a4211846a4bd74046b8657b06f3562a0 Mon Sep 17 00:00:00 2001 From: Adam Wallis Date: Wed, 18 Jul 2018 10:11:44 -0400 Subject: [PATCH 075/123] Only initialize FZF_DEFAULT_COMMAND if not already set --- plugins/available/fzf.plugin.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/available/fzf.plugin.bash b/plugins/available/fzf.plugin.bash index 5aacc37d..f2eddeb1 100644 --- a/plugins/available/fzf.plugin.bash +++ b/plugins/available/fzf.plugin.bash @@ -6,7 +6,9 @@ about-plugin 'load fzf, if you are using it' [ -f ~/.fzf.bash ] && source ~/.fzf.bash -command -v fd &> /dev/null && export FZF_DEFAULT_COMMAND='fd --type f' +if [ -z ${FZF_DEFAULT_COMMAND+x} ]; then + command -v fd &> /dev/null && export FZF_DEFAULT_COMMAND='fd --type f' +fi fe() { about "Open the selected file in the default editor" From 4192d07f4f7fa9d56e02b83129f2ec4ce8cf8f6f Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Thu, 19 Jul 2018 08:58:05 +0200 Subject: [PATCH 076/123] Fixed indentation and a broken character --- lib/helpers.bash | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index e8fc19ba..f67ebea9 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -61,7 +61,7 @@ function reload_plugins() { bash-it () { about 'Bash-it help and maintenance' - param '1: verb [one of: help | show | enable | disable | migrate | update | search | version | reload ] ' + param '1: verb [one of: help | show | enable | disable | migrate | update | search | version | reload ] ' param '2: component type [one of: alias(es) | completion(s) | plugin(s) ] or search term(s)' param '3: specific component [optional]' example '$ bash-it show plugins' @@ -79,28 +79,28 @@ bash-it () shift typeset func case $verb in - show) - func=_bash-it-$component;; - enable) - func=_enable-$component;; - disable) - func=_disable-$component;; - help) - func=_help-$component;; - search) - _bash-it-search $component "$@" - return;; - update) - func=_bash-it_update;; - migrate) - func=_bash-it-migrate;; - version) - func=_bash-it-version;; - reload) - func=_bash-it-reload;; - *) - reference bash-it - return;; + show) + func=_bash-it-$component;; + enable) + func=_enable-$component;; + disable) + func=_disable-$component;; + help) + func=_help-$component;; + search) + _bash-it-search $component "$@" + return;; + update) + func=_bash-it_update;; + migrate) + func=_bash-it-migrate;; + version) + func=_bash-it-version;; + reload) + func=_bash-it-reload;; + *) + reference bash-it + return;; esac # pluralize component if necessary @@ -270,7 +270,7 @@ _bash-it-reload() { source ~/.bashrc ;; esac - + cd - &> /dev/null || return } From f6e2fdd2cfd02931c9a4f491e710bced5e213912 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Thu, 19 Jul 2018 09:00:02 +0200 Subject: [PATCH 077/123] Fixed reload command in the update function --- lib/helpers.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index f67ebea9..a2c0d3aa 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -187,7 +187,7 @@ _bash-it_update() { _bash-it-migrate echo "" echo "All done, enjoy!" - reload + bash-it reload else echo "Error updating Bash-it, please, check if your Bash-it installation folder (${BASH_IT}) is clean." fi From d00762d3cd63d41a0c7f4e978be62bf88dda3555 Mon Sep 17 00:00:00 2001 From: Raphael Parree Date: Thu, 26 Jul 2018 09:51:25 +0200 Subject: [PATCH 078/123] added minikube completion support --- completion/available/minikube.completion.bash | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 completion/available/minikube.completion.bash diff --git a/completion/available/minikube.completion.bash b/completion/available/minikube.completion.bash new file mode 100644 index 00000000..f1d19b87 --- /dev/null +++ b/completion/available/minikube.completion.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# minikube (Local Kubernetes) completion + +if command -v minikube &>/dev/null +then + eval "$(minikube completion bash)" +fi From f8473714472ba8c59e4e0b3e3d95bf78f31871c3 Mon Sep 17 00:00:00 2001 From: Enze Chi Date: Thu, 2 Aug 2018 21:46:20 +1000 Subject: [PATCH 079/123] Avoid double semicolon in the PROMPT_COMMAND The direnv bash hook already add a semicolon to the PROMPT_COMMAND and this plugin will add another one if direnv is installed. This commit will check if the PROMPT_COMMAND ends with semicolon to avoid have double ones. --- plugins/available/osx.plugin.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/available/osx.plugin.bash b/plugins/available/osx.plugin.bash index 2dba0279..0e74ab8d 100644 --- a/plugins/available/osx.plugin.bash +++ b/plugins/available/osx.plugin.bash @@ -5,7 +5,7 @@ about-plugin 'osx-specific functions' if [ $(uname) = "Darwin" ]; then if type update_terminal_cwd > /dev/null 2>&1 ; then if ! [[ $PROMPT_COMMAND =~ (^|;)update_terminal_cwd($|;) ]] ; then - PROMPT_COMMAND="$PROMPT_COMMAND;update_terminal_cwd" + PROMPT_COMMAND="${PROMPT_COMMAND%;};update_terminal_cwd" declared="$(declare -p PROMPT_COMMAND)" [[ "$declared" =~ \ -[aAilrtu]*x[aAilrtu]*\ ]] 2>/dev/null [[ $? -eq 0 ]] && export PROMPT_COMMAND From 0960c1b26c46631e7c83d06937aa66e375cd7cc8 Mon Sep 17 00:00:00 2001 From: Jeremy Mathevet Date: Sun, 5 Aug 2018 20:24:40 +0100 Subject: [PATCH 080/123] kubectl aliases --- aliases/available/kubectl.aliases.bash | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 aliases/available/kubectl.aliases.bash diff --git a/aliases/available/kubectl.aliases.bash b/aliases/available/kubectl.aliases.bash new file mode 100644 index 00000000..58670ce5 --- /dev/null +++ b/aliases/available/kubectl.aliases.bash @@ -0,0 +1,24 @@ +#!/bin/bash +# +# -binaryanomaly + +cite 'about-alias' +about-alias 'kubectl aliases' + +# set apt aliases +function _set_pkg_aliases() +{ + if [ -x $(which kubectl) ]; then + alias kc='kubectl' + alias kcgp='kubectl get pods' + alias kcgd='kubectl get deployments' + alias kcgn='kubectl get nodes' + alias kcdp='kubectl describe pod' + alias kcdd='kubectl describe deployment' + alias kcdn='kubectl describe node' + alias kcgpan='kubectl get pods --all-namespaces' + alias kcgdan='kubectl get deployments --all-namespaces' + fi +} + +_set_pkg_aliases From 681aa230d836c8a89fb2eec6c645f4f14cbdc42f Mon Sep 17 00:00:00 2001 From: Cody Horst Date: Tue, 14 Aug 2018 20:40:28 -0700 Subject: [PATCH 081/123] add support for conda --- themes/zork/zork.theme.bash | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/themes/zork/zork.theme.bash b/themes/zork/zork.theme.bash index 75bc17d6..07f30e12 100644 --- a/themes/zork/zork.theme.bash +++ b/themes/zork/zork.theme.bash @@ -57,7 +57,12 @@ chroot(){ # show virtualenvwrapper my_ve(){ - if [ -n "$VIRTUAL_ENV" ] + + if [ -n "$CONDA_DEFAULT_ENV" ] + then + my_ps_ve="${bold_purple}${CONDA_DEFAULT_ENV}${normal}"; + echo "($my_ps_ve)"; + elif [ -n "$VIRTUAL_ENV" ] then my_ps_ve="${bold_purple}$ve${normal}"; echo "($my_ps_ve)"; From 52945d37c2fae4761ee15036360a76101e44ebfd Mon Sep 17 00:00:00 2001 From: Semyon Gashchenko Date: Sun, 26 Aug 2018 00:11:23 +0300 Subject: [PATCH 082/123] Add mvn package aliases --- aliases/available/maven.aliases.bash | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aliases/available/maven.aliases.bash b/aliases/available/maven.aliases.bash index 4cd89d27..f8a44a1c 100644 --- a/aliases/available/maven.aliases.bash +++ b/aliases/available/maven.aliases.bash @@ -3,9 +3,12 @@ about-alias 'maven abbreviations' alias mci='mvn clean install' alias mi='mvn install' +alias mcp='mvn clean package' +alias mp='mvn package' alias mrprep='mvn release:prepare' alias mrperf='mvn release:perform' alias mrrb='mvn release:rollback' alias mdep='mvn dependency:tree' alias mpom='mvn help:effective-pom' alias mcisk='mci -Dmaven.test.skip=true' +alias mcpsk='mcp -Dmaven.test.skip=true' From ac5a8aca47f42c6feab6bde3fb7e5a06d53f28ff Mon Sep 17 00:00:00 2001 From: Rutger Lubbers Date: Mon, 27 Aug 2018 12:32:12 +0200 Subject: [PATCH 083/123] Added completion of installable versions The versions that can be installed were not completed. The list of available versions showed the installed versions. The function retrieves the available versions and removes the already installed versions. --- completion/available/sdkman.completion.bash | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/completion/available/sdkman.completion.bash b/completion/available/sdkman.completion.bash index f5af6c6a..b4d62da1 100644 --- a/completion/available/sdkman.completion.bash +++ b/completion/available/sdkman.completion.bash @@ -27,10 +27,14 @@ _sdkman_complete() esac elif [ $COMP_CWORD -eq 3 ]; then case "${COMP_WORDS[COMP_CWORD-2]}" in - "install" | "uninstall" | "rm" | "use" | "default" ) + "uninstall" | "rm" | "use" | "default" ) _sdkman_candidate_versions ${COMP_WORDS[COMP_CWORD-1]} COMPREPLY=( $(compgen -W "$CANDIDATE_VERSIONS" -- ${COMP_WORDS[COMP_CWORD]}) ) ;; + "install") + _sdkman_candidate_not_installed_versions ${COMP_WORDS[COMP_CWORD-1]} + COMPREPLY=( $(compgen -W "$CANDIDATE_VERSIONS" -- ${COMP_WORDS[COMP_CWORD]}) ) + ;; *) ;; esac @@ -51,6 +55,14 @@ _sdkman_candidate_versions(){ } +_sdkman_candidate_not_installed_versions(){ + CANDIDATE_LOCAL_VERSIONS=$(__sdkman_cleanup_local_versions $1) + if [ "$SDKMAN_OFFLINE_MODE" = "false" ]; then + CANDIDATE_ONLINE_VERSIONS="$(__sdkman_list_versions $1 | grep " " | grep "\." | cut -c 6-)" + CANDIDATE_VERSIONS="$(echo $CANDIDATE_ONLINE_VERSIONS $CANDIDATE_LOCAL_VERSIONS | tr ' ' '\n' | sort | uniq -u) " + fi +} + __sdkman_cleanup_local_versions(){ __sdkman_build_version_csv $1 | tr ',' ' ' From c5e8349f698e36ed28265e9c4e6b485a0ed17322 Mon Sep 17 00:00:00 2001 From: Ahmad Assaf Date: Wed, 29 Aug 2018 15:00:46 +0100 Subject: [PATCH 084/123] Fixing Error when starting Terminal after installing Bash-IT --- completion/available/system.completion.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/completion/available/system.completion.bash b/completion/available/system.completion.bash index b044627c..f9a3b29f 100644 --- a/completion/available/system.completion.bash +++ b/completion/available/system.completion.bash @@ -20,8 +20,8 @@ if [ $(uname) = "Darwin" ] && command -v brew &>/dev/null ; then . "$BREW_PREFIX"/etc/bash_completion fi - # homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path - if [ -f "$BREW_PREFIX"/share/bash-completion/bash_completion ]; then + # homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path + if [ "${BASH_VERSINFO}" -ge 4 ] && [ -f "$BREW_PREFIX"/share/bash-completion/bash_completion ]; then . "$BREW_PREFIX"/share/bash-completion/bash_completion fi fi From 76de592cafb021c3168d89b2dd5d4571eb0e895c Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Thu, 30 Aug 2018 18:43:00 -0500 Subject: [PATCH 085/123] Add Crystal auto-completion on Mac --- completion/available/crystal.completion.bash | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 completion/available/crystal.completion.bash diff --git a/completion/available/crystal.completion.bash b/completion/available/crystal.completion.bash new file mode 100644 index 00000000..b83be253 --- /dev/null +++ b/completion/available/crystal.completion.bash @@ -0,0 +1,8 @@ +if which crystal >/dev/null 2>&1; then + BREW_PREFIX=$(brew --prefix) + + if [ -f "$BREW_PREFIX"/etc/bash_completion.d/crystal ]; then + . "$BREW_PREFIX"/etc/bash_completion.d/crystal + fi + +fi From bdc31aa55d9a4803fbf6d5efad27735a1f0da6ac Mon Sep 17 00:00:00 2001 From: Claudia Date: Tue, 4 Sep 2018 07:25:28 +0200 Subject: [PATCH 086/123] Remove alias for `brew cask search` In Homebrew (the upstream project), `brew cask search` was merged into `brew search` a few months ago [1]. On 2018-09-30, `brew cask search` will be disabled altogether [2]. Since the output of `brew cask search` used to be subject to change at any time and was never meant to be parsed, scripts should not rely on the `bcsr` alias. So I figure it may not hurt to remove the `bcsr` alias from Bash-it before that deadline. [1]: https://github.com/Homebrew/brew/pull/4316 [2]: https://github.com/Homebrew/brew/commit/990dd7de865ccbbc0d0ef5fb62256a86f1c92133 --- aliases/available/homebrew-cask.aliases.bash | 1 - 1 file changed, 1 deletion(-) diff --git a/aliases/available/homebrew-cask.aliases.bash b/aliases/available/homebrew-cask.aliases.bash index 090622b0..57d8161c 100644 --- a/aliases/available/homebrew-cask.aliases.bash +++ b/aliases/available/homebrew-cask.aliases.bash @@ -7,7 +7,6 @@ alias bcin='brew cask install' alias bcrm='brew cask uninstall' alias bczp='brew cask zap' alias bccl='brew cask cleanup' -alias bcsr='brew cask search' alias bcls='brew cask list' alias bcinf='brew cask info' alias bcdr='brew cask doctor' From e6d6b47abea489acc3fb658ff0d5f651cbe76039 Mon Sep 17 00:00:00 2001 From: penguin2048 Date: Mon, 10 Sep 2018 19:20:22 +0530 Subject: [PATCH 087/123] Add virtual env support for elixr theme --- themes/elixr/elixr.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/elixr/elixr.theme.bash b/themes/elixr/elixr.theme.bash index 0e37f94c..266abbad 100644 --- a/themes/elixr/elixr.theme.bash +++ b/themes/elixr/elixr.theme.bash @@ -17,7 +17,7 @@ RVM_THEME_PROMPT_SUFFIX=" d|" BOLD="\[\e[1m\]" function prompt_command() { - PS1="\n${bold_cyan}$(scm_prompt_char_info) ${bold_cyan}\w :${reset_color}${normal}${BOLD} " + PS1="\n${bold_cyan}$(scm_prompt_char_info)$(virtualenv_prompt) ${bold_cyan}\w :${reset_color}${normal}${BOLD} " } safe_append_prompt_command prompt_command From 28c55f86dbe8a3e2be2d95ec1022407893e8e486 Mon Sep 17 00:00:00 2001 From: Dinos Stamou Date: Tue, 25 Sep 2018 17:11:37 +0300 Subject: [PATCH 088/123] Fix Demula theme first line issue --- themes/demula/demula.theme.bash | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/themes/demula/demula.theme.bash b/themes/demula/demula.theme.bash index 515d096d..e85c18f7 100644 --- a/themes/demula/demula.theme.bash +++ b/themes/demula/demula.theme.bash @@ -100,8 +100,7 @@ prompt() { if [ $(uname) = "Linux" ]; then - PS1="${TITLEBAR} -${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\ + PS1="${TITLEBAR}${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT} $(safe_battery_charge)${RESTORE_CURSOR}\ ${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\ at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\ @@ -113,7 +112,7 @@ ${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}" else PS1="${TITLEBAR} ${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\ -at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\ +at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\ in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\ ${LAST_COMMAND_FAILED}\ $(demula_vcprompt)\ From 14b2dbde858729feedc3142c0e5077948f8c4c9d Mon Sep 17 00:00:00 2001 From: Ari Mourao Date: Tue, 2 Oct 2018 15:18:54 -0300 Subject: [PATCH 089/123] docker-compose up and docker exec -it aliases --- aliases/available/docker-compose.aliases.bash | 1 + aliases/available/docker.aliases.bash | 1 + 2 files changed, 2 insertions(+) diff --git a/aliases/available/docker-compose.aliases.bash b/aliases/available/docker-compose.aliases.bash index 01eb62fb..f23c2689 100644 --- a/aliases/available/docker-compose.aliases.bash +++ b/aliases/available/docker-compose.aliases.bash @@ -4,3 +4,4 @@ about-alias 'docker-compose abbreviations' alias dco="docker-compose" alias dcofresh="docker-compose-fresh" alias dcol="docker-compose logs -f --tail 100" +alias dcou="docker-compose up" diff --git a/aliases/available/docker.aliases.bash b/aliases/available/docker.aliases.bash index e3601d6f..ee7a037f 100644 --- a/aliases/available/docker.aliases.bash +++ b/aliases/available/docker.aliases.bash @@ -25,3 +25,4 @@ alias dkrmi='docker-remove-images' # Delete images for supplied IDs or all if n alias dkideps='docker-image-dependencies' # Output a graph of image dependencies using Graphiz alias dkre='docker-runtime-environment' # List environmental variables of the supplied image ID alias dkelc='docker exec -it `dklcid` bash' # Enter last container (works with Docker 1.3 and above) +alias dkex='docker exec -it ' # Useful to run any commands into container without leaving host From e69d1b82d8b3762cb422fa6d70ad319d6737e438 Mon Sep 17 00:00:00 2001 From: Kelly Stannard Date: Wed, 3 Oct 2018 10:02:44 -0400 Subject: [PATCH 090/123] further bundle exec completion examples: `bundle exec rsp` + TAB => `bundle exec rspec` `bundle exec rspec --no` + TAB => `bundle exec rspec --no-color` --- completion/available/bundler.completion.bash | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/completion/available/bundler.completion.bash b/completion/available/bundler.completion.bash index 274a4a36..cdb7cf54 100644 --- a/completion/available/bundler.completion.bash +++ b/completion/available/bundler.completion.bash @@ -21,6 +21,9 @@ __bundle() { if [[ -z $bundle_command ]]; then options="$options --version --help" fi + elif [[ $bundle_command = "exec" ]]; then + _bundle_exec_completions + return else if [[ -z $bundle_command || $bundle_command = help ]]; then options="help install update package exec config check list show @@ -53,3 +56,10 @@ __bundle_get_command() { complete -F __bundle -o bashdefault -o default bundle # vim: ai ft=sh sw=4 sts=2 et + +_bundle_exec_completions() +{ + if [[ $COMP_CWORD = 2 ]]; then + COMPREPLY=($(compgen -c -- "$2")) + fi +} From 07a1499ec05a9527d7e1b50ee99b4332b67241e0 Mon Sep 17 00:00:00 2001 From: Ari Mourao Date: Wed, 3 Oct 2018 11:11:51 -0300 Subject: [PATCH 091/123] duplicated git commit -a -m entry removed --- aliases/available/git.aliases.bash | 1 - 1 file changed, 1 deletion(-) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index fa411346..169fe7b8 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -42,7 +42,6 @@ alias gca='git commit -v -a' alias gcm='git commit -v -m' alias gcam="git commit -v -am" alias gci='git commit --interactive' -alias gcam='git commit -a -m' alias gb='git branch' alias gba='git branch -a' alias gbt='git branch --track' From 025554d79d9e67e6846095107a96f16cbe912ecf Mon Sep 17 00:00:00 2001 From: Saulius Gurklys Date: Sat, 6 Oct 2018 16:44:37 +0300 Subject: [PATCH 092/123] Add minimal HG prompt to powerline themes --- themes/powerline-multiline/powerline-multiline.theme.bash | 1 + themes/powerline-naked/powerline-naked.theme.bash | 1 + themes/powerline-plain/powerline-plain.theme.bash | 1 + themes/powerline/powerline.base.bash | 2 ++ themes/powerline/powerline.theme.bash | 1 + 5 files changed, 6 insertions(+) diff --git a/themes/powerline-multiline/powerline-multiline.theme.bash b/themes/powerline-multiline/powerline-multiline.theme.bash index a62a7060..5af4dba2 100644 --- a/themes/powerline-multiline/powerline-multiline.theme.bash +++ b/themes/powerline-multiline/powerline-multiline.theme.bash @@ -20,6 +20,7 @@ PYTHON_VENV_THEME_PROMPT_COLOR=35 SCM_NONE_CHAR="" SCM_GIT_CHAR=${POWERLINE_SCM_GIT_CHAR:=" "} +SCM_HG_CHAR=${POWERLINE_SCM_HG_CHAR:="☿ "} SCM_THEME_PROMPT_CLEAN="" SCM_THEME_PROMPT_DIRTY="" SCM_THEME_PROMPT_CLEAN_COLOR=25 diff --git a/themes/powerline-naked/powerline-naked.theme.bash b/themes/powerline-naked/powerline-naked.theme.bash index 1897a6ba..08e2a1f5 100644 --- a/themes/powerline-naked/powerline-naked.theme.bash +++ b/themes/powerline-naked/powerline-naked.theme.bash @@ -16,6 +16,7 @@ PYTHON_VENV_THEME_PROMPT_COLOR=35 SCM_NONE_CHAR="" SCM_GIT_CHAR=${POWERLINE_SCM_GIT_CHAR:=" "} +SCM_HG_CHAR=${POWERLINE_SCM_HG_CHAR:="☿ "} SCM_THEME_PROMPT_CLEAN="" SCM_THEME_PROMPT_DIRTY="" SCM_THEME_PROMPT_COLOR=238 diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash index 53da88b4..cdcb3cc2 100644 --- a/themes/powerline-plain/powerline-plain.theme.bash +++ b/themes/powerline-plain/powerline-plain.theme.bash @@ -12,6 +12,7 @@ PYTHON_VENV_THEME_PROMPT_COLOR=35 SCM_NONE_CHAR="" SCM_GIT_CHAR=${POWERLINE_SCM_GIT_CHAR:="⎇ "} +SCM_HG_CHAR=${POWERLINE_SCM_HG_CHAR:="☿ "} SCM_THEME_PROMPT_CLEAN="" SCM_THEME_PROMPT_DIRTY="" SCM_THEME_PROMPT_CLEAN_COLOR=25 diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index ade246e9..78b6d710 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -86,6 +86,8 @@ function __powerline_scm_prompt { scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" elif [[ "${SCM_P4_CHAR}" == "${SCM_CHAR}" ]]; then scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" + elif [[ "${SCM_HG_CHAR}" == "${SCM_CHAR}" ]]; then + scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" fi echo "${scm_prompt}${scm}|${color}" fi diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index df72a73f..d3bb242a 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -15,6 +15,7 @@ PYTHON_VENV_THEME_PROMPT_COLOR=35 SCM_NONE_CHAR="" SCM_GIT_CHAR=${POWERLINE_SCM_GIT_CHAR:=" "} +SCM_HG_CHAR=${POWERLINE_SCM_HG_CHAR:="☿ "} SCM_THEME_PROMPT_CLEAN="" SCM_THEME_PROMPT_DIRTY="" SCM_THEME_PROMPT_CLEAN_COLOR=25 From d0f76548ce6af2b208dfb385ac79ef201b56f5d1 Mon Sep 17 00:00:00 2001 From: sharils Date: Tue, 16 Oct 2018 21:45:16 +0800 Subject: [PATCH 093/123] Add SCM_GIT_SHOW_STASH_INFO flag #914 In order to make `git_prompt_vars` run faster As a user with slow `git stash list` I want to be able to optionally disable running `git stash list` when `git_prompt_vars` is executed --- README.md | 13 +++++++++++++ themes/base.theme.bash | 9 ++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 022ce442..e73fc55d 100644 --- a/README.md +++ b/README.md @@ -312,6 +312,19 @@ Also, with this flag to false, Bash-it will not show the repository as dirty whe **NOTE:** If you set in git configuration file the option to ignore *untracked* files, this flag has no effect, and Bash-it will ignore *untracked* files always. +### Stash item count + +When `SCM_GIT_SHOW_DETAILS` is enabled, you can get the count of *stashed* items. This feature can be useful when a user has a lot of stash items. +This feature is controlled through the flag `SCM_GIT_SHOW_STASH_INFO` as follows: + +Set `SCM_GIT_SHOW_STASH_INFO` to 'true' (the default value) to **show** the count of stashed items: + +* `export SCM_GIT_SHOW_STASH_INFO=true` + +Set `SCM_GIT_SHOW_STASH_INFO` to 'false' to **don't show** it: + +* `export SCM_GIT_SHOW_STASH_INFO=false` + ### Git user In some environments, it is useful to know the value of the current git user, which is used to mark all new commits. diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 7895e5cf..51d5f359 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -32,6 +32,7 @@ SCM_GIT_SHOW_REMOTE_INFO=${SCM_GIT_SHOW_REMOTE_INFO:=auto} SCM_GIT_IGNORE_UNTRACKED=${SCM_GIT_IGNORE_UNTRACKED:=false} SCM_GIT_SHOW_CURRENT_USER=${SCM_GIT_SHOW_CURRENT_USER:=false} SCM_GIT_SHOW_MINIMAL_INFO=${SCM_GIT_SHOW_MINIMAL_INFO:=false} +SCM_GIT_SHOW_STASH_INFO=${SCM_GIT_SHOW_STASH_INFO:=true} SCM_GIT='git' SCM_GIT_CHAR='±' @@ -181,9 +182,11 @@ function git_prompt_vars { [[ "${commits_ahead}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_AHEAD_CHAR}${commits_ahead}" [[ "${commits_behind}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_BEHIND_CHAR}${commits_behind}" - local stash_count - stash_count="$(git stash list 2> /dev/null | wc -l | tr -d ' ')" - [[ "${stash_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_STASH_CHAR_PREFIX}${stash_count}${SCM_GIT_STASH_CHAR_SUFFIX}" + if [[ "${SCM_GIT_SHOW_STASH_INFO}" = "true" ]]; then + local stash_count + stash_count="$(git stash list 2> /dev/null | wc -l | tr -d ' ')" + [[ "${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 From 502de11c2fa38d2a4ef86adf6ae1132d825e9400 Mon Sep 17 00:00:00 2001 From: Enze Chi Date: Thu, 18 Oct 2018 10:57:54 +1100 Subject: [PATCH 094/123] Use go binary to get default GOROOT and GOPATH --- plugins/available/go.plugin.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 plugins/available/go.plugin.bash diff --git a/plugins/available/go.plugin.bash b/plugins/available/go.plugin.bash old mode 100644 new mode 100755 index c9fcdff8..827ac388 --- a/plugins/available/go.plugin.bash +++ b/plugins/available/go.plugin.bash @@ -5,7 +5,7 @@ about-plugin 'go environment variables & path configuration' [ ! command -v go &>/dev/null ] && return -export GOROOT=${GOROOT:-$(go env | grep GOROOT | cut -d'"' -f2)} +export GOROOT=${GOROOT:-$(go env GOROOT)} pathmunge "${GOROOT}/bin" -export GOPATH=${GOPATH:-"$HOME/go"} +export GOPATH=${GOPATH:-$(go env GOPATH)} pathmunge "${GOPATH}/bin" From 9040359f6c7d05b17b796c4cf64939d340e19029 Mon Sep 17 00:00:00 2001 From: "William A. O. Brown" Date: Thu, 25 Oct 2018 21:37:35 +0100 Subject: [PATCH 095/123] Add Lerna completion options --- completion/available/lerna.completion.bash | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 completion/available/lerna.completion.bash diff --git a/completion/available/lerna.completion.bash b/completion/available/lerna.completion.bash new file mode 100644 index 00000000..f8439d3e --- /dev/null +++ b/completion/available/lerna.completion.bash @@ -0,0 +1,25 @@ +#!/bin/bash +# Usage: +# +# To enable bash completion for lerna, add the following line (minus the +# leading #, which is the bash comment character) to your ~/.bashrc file: +# +# eval "$(lerna --completion=bash)" +# Enable bash autocompletion. +function _lerna_completions() { + # The currently-being-completed word. + local cur compls + + cur="${COMP_WORDS[COMP_CWORD]}" + + # Options + compls="add bootstrap changed clean create diff exec \ + import init link list publish run version \ + --loglevel --concurrency --reject-cycles \ + --progress --sort --no-sort --help \ + --version" + + # Tell complete what stuff to show. + COMPREPLY=($(compgen -W "$compls" -- "$cur")) +} +complete -o default -F _lerna_completions lerna From b9c34cb9c297989581cf743cece984e8d4e34b05 Mon Sep 17 00:00:00 2001 From: "William A. O. Brown" Date: Thu, 25 Oct 2018 21:40:57 +0100 Subject: [PATCH 096/123] Remove some comments --- completion/available/lerna.completion.bash | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/completion/available/lerna.completion.bash b/completion/available/lerna.completion.bash index f8439d3e..792ea27b 100644 --- a/completion/available/lerna.completion.bash +++ b/completion/available/lerna.completion.bash @@ -1,15 +1,9 @@ #!/bin/bash -# Usage: -# -# To enable bash completion for lerna, add the following line (minus the -# leading #, which is the bash comment character) to your ~/.bashrc file: -# -# eval "$(lerna --completion=bash)" -# Enable bash autocompletion. +# Lerna autocompletion. function _lerna_completions() { - # The currently-being-completed word. local cur compls + # The currently-being-completed word. cur="${COMP_WORDS[COMP_CWORD]}" # Options From 7661b561bfe25911e57764a4b79ad778ad2ce063 Mon Sep 17 00:00:00 2001 From: Septian Dwic Date: Fri, 26 Oct 2018 17:33:53 +0700 Subject: [PATCH 097/123] Fix `fabric-completion.bash` to `fabric` When a `bash-it show completion` command is executed --- .../available/{fabric-completion.bash => fabric.completion.bash} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename completion/available/{fabric-completion.bash => fabric.completion.bash} (100%) diff --git a/completion/available/fabric-completion.bash b/completion/available/fabric.completion.bash similarity index 100% rename from completion/available/fabric-completion.bash rename to completion/available/fabric.completion.bash From 6cc7b9112e8dab0e48721282342e289b5add277e Mon Sep 17 00:00:00 2001 From: Septian Dwic Date: Fri, 26 Oct 2018 21:49:52 +0700 Subject: [PATCH 098/123] Don't export ruby-build/bin to PATH If ruby-build is installed as a rbenv plugin, ruby-build/bin directories automatically included. --- plugins/available/rbenv.plugin.bash | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/available/rbenv.plugin.bash b/plugins/available/rbenv.plugin.bash index b1388017..75d24154 100644 --- a/plugins/available/rbenv.plugin.bash +++ b/plugins/available/rbenv.plugin.bash @@ -1,9 +1,10 @@ -# Load rbebv, if you are using it - cite about-plugin about-plugin 'load rbenv, if you are using it' -pathmunge "$HOME"/.rbenv/bin -[ -x `which rbenv` ] && eval "$(rbenv init -)" +export RBENV_ROOT="$HOME/.rbenv" +pathmunge "$RBENV_ROOT/bin" -[ -d "$HOME"/.rbenv/plugins/ruby-build ] && pathmunge "$HOME"/.rbenv/plugins/ruby-build/bin +[[ `which rbenv` ]] && eval "$(rbenv init -)" + +# Load the auto-completion script if rbenv was loaded. +[[ -e $RBENV_ROOT/completions/rbenv.bash ]] && source $RBENV_ROOT/completions/rbenv.bash From 089b10b37cd9dcd6e157d5b1d4136ccfe7cbfabc Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Sat, 27 Oct 2018 23:01:35 +0200 Subject: [PATCH 099/123] Update AWS variable name AWS_DEFAULT_PROFILE is deprecated, AWS_PROFILE is the correct one now. +info: https://docs.aws.amazon.com/cli/latest/userguide/cli-environment.html --- plugins/available/aws.plugin.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/available/aws.plugin.bash b/plugins/available/aws.plugin.bash index 1519f77b..a8941e07 100644 --- a/plugins/available/aws.plugin.bash +++ b/plugins/available/aws.plugin.bash @@ -72,14 +72,14 @@ function __awskeys_export { export "$(echo ${key} | tr [:lower:] [:upper:])=${p_key#*=}" done fi - export AWS_DEFAULT_PROFILE="$1" + export AWS_PROFILE="$1" else echo "Profile $1 not found in credentials file" fi } function __awskeys_unset { - unset AWS_DEFAULT_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY + unset AWS_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY } function __awskeys_comp { From 84b6fde653f2b6740bfa82eec788eaf43c145466 Mon Sep 17 00:00:00 2001 From: Robert Treat Date: Mon, 29 Oct 2018 18:34:28 -0500 Subject: [PATCH 100/123] Make Postgres name use consistent --- plugins/available/postgres.plugin.bash | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/available/postgres.plugin.bash b/plugins/available/postgres.plugin.bash index b90d8d76..e481d734 100644 --- a/plugins/available/postgres.plugin.bash +++ b/plugins/available/postgres.plugin.bash @@ -20,23 +20,23 @@ done function postgres_start { - about 'Starts PostgresSQL server' + about 'Starts PostgreSQL server' group 'postgres' - echo 'Starting PostgresSQL Server....'; + echo 'Starting Postgres....'; $POSTGRES_BIN/pg_ctl -D $PGDATA -l $PGDATA/logfile start } function postgres_stop { - about 'Steps PostgresSQL server' + about 'Stops PostgreSQL server' group 'postgres' - echo 'Stopping PostgresSQL Server....'; + echo 'Stopping Postgres....'; $POSTGRES_BIN/pg_ctl -D $PGDATA -l $PGDATA/logfile stop -s -m fast } function postgres_status { - about 'Returns status of PostgresSQL server' + about 'Returns status of PostgreSQL server' group 'postgres' # $POSTGRES_BIN/pg_ctl -D $PGDATA status @@ -55,7 +55,7 @@ function is_postgres_running { function postgres_restart { - about 'Restarts status of PostgresSQL server' + about 'Restarts status of PostgreSQL server' group 'postgres' echo 'Restarting Postgres....'; From 12ff176c5597f52d7417eb4a572e3a62075a527e Mon Sep 17 00:00:00 2001 From: Pablo Diaz Date: Tue, 30 Oct 2018 22:54:46 +0100 Subject: [PATCH 101/123] aws session token support --- plugins/available/aws.plugin.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/available/aws.plugin.bash b/plugins/available/aws.plugin.bash index a8941e07..81d88f97 100644 --- a/plugins/available/aws.plugin.bash +++ b/plugins/available/aws.plugin.bash @@ -37,7 +37,7 @@ function __awskeys_help { function __awskeys_get { local ln=$(grep -n "\[ *$1 *\]" ~/.aws/credentials | cut -d ":" -f 1) if [[ -n "${ln}" ]]; then - tail -n +${ln} ~/.aws/credentials | egrep -m 2 "aws_access_key_id|aws_secret_access_key" + tail -n +${ln} ~/.aws/credentials | egrep -m 3 "aws_access_key_id|aws_secret_access_key|aws_session_token" fi } @@ -79,7 +79,7 @@ function __awskeys_export { } function __awskeys_unset { - unset AWS_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY + unset AWS_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN } function __awskeys_comp { From d41eac5db2e5e7e8a246de93054af9741f052ae5 Mon Sep 17 00:00:00 2001 From: Matthew Bates Date: Wed, 31 Oct 2018 07:42:45 +0000 Subject: [PATCH 102/123] Added puppet bolt aliases --- aliases/available/bolt.bash | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 aliases/available/bolt.bash diff --git a/aliases/available/bolt.bash b/aliases/available/bolt.bash new file mode 100644 index 00000000..8490f710 --- /dev/null +++ b/aliases/available/bolt.bash @@ -0,0 +1,8 @@ +cite 'about-alias' +about-alias 'puppet bolt aliases' + +# Aliases +alias bolt='bolt command run --tty --no-host-key-check' +alias boltas='bolt -p -u' +alias sudobolt='bolt --run-as root --sudo-password' +alias sudoboltas='sudobolt -p -u' From c96cda1ff5782f008d1630bef8311817ce155f26 Mon Sep 17 00:00:00 2001 From: Matthew Bates Date: Wed, 31 Oct 2018 07:54:22 +0000 Subject: [PATCH 103/123] Added puppet aliases --- aliases/available/puppet.aliases.bash | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 aliases/available/puppet.aliases.bash diff --git a/aliases/available/puppet.aliases.bash b/aliases/available/puppet.aliases.bash new file mode 100644 index 00000000..bb5b4a1a --- /dev/null +++ b/aliases/available/puppet.aliases.bash @@ -0,0 +1,10 @@ +cite 'about-alias' +about-alias 'puppet aliases' + +# Aliases +alias pupval="puppet parser validate *.pp" +alias puplint="puppet-lint *.pp" +alias pupagt="puppet agent -t" +alias pupagtd="puppet agent -t --debug" +alias pupapp="puppet apply" + From dd6d5ce6877ba0a697e1c8ed5eff0190a14e3fef Mon Sep 17 00:00:00 2001 From: Matthew Bates Date: Wed, 31 Oct 2018 07:55:40 +0000 Subject: [PATCH 104/123] Renamed to match convention --- aliases/available/{bolt.bash => bolt.aliases.bash} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename aliases/available/{bolt.bash => bolt.aliases.bash} (100%) diff --git a/aliases/available/bolt.bash b/aliases/available/bolt.aliases.bash similarity index 100% rename from aliases/available/bolt.bash rename to aliases/available/bolt.aliases.bash From f41324251fe7e46ea530a55febe5017700d44b3b Mon Sep 17 00:00:00 2001 From: Matthew Bates Date: Wed, 31 Oct 2018 08:07:57 +0000 Subject: [PATCH 105/123] Added more recently available docker cleanup commands --- aliases/available/docker.aliases.bash | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/aliases/available/docker.aliases.bash b/aliases/available/docker.aliases.bash index ee7a037f..418c6235 100644 --- a/aliases/available/docker.aliases.bash +++ b/aliases/available/docker.aliases.bash @@ -26,3 +26,8 @@ alias dkideps='docker-image-dependencies' # Output a graph of image dependencie alias dkre='docker-runtime-environment' # List environmental variables of the supplied image ID alias dkelc='docker exec -it `dklcid` bash' # Enter last container (works with Docker 1.3 and above) alias dkex='docker exec -it ' # Useful to run any commands into container without leaving host + +# Added more recent cleanup options from newer docker versions +alias dkip=`docker image prune -a -f` +alias dkvp=`docker volume prune -f` +alias dksp=`docker system prune -a -f` From 3c8dbf3cd489d6a0f6f2b2bfa5c49ee243219cd8 Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Wed, 31 Oct 2018 19:18:37 +0100 Subject: [PATCH 106/123] Allow custom aws config files path Honor the environment variables: AWS_CONFIG_FILE AWS_SHARED_CREDENTIALS_FILE in the aws plugin. +info: https://docs.aws.amazon.com/cli/latest/userguide/cli-environment.html --- plugins/available/aws.plugin.bash | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/available/aws.plugin.bash b/plugins/available/aws.plugin.bash index 81d88f97..66021267 100644 --- a/plugins/available/aws.plugin.bash +++ b/plugins/available/aws.plugin.bash @@ -1,11 +1,14 @@ cite about-plugin about-plugin 'AWS helper functions' +AWS_CONFIG_FILE="${AWS_CONFIG_FILE:-$HOME/.aws/config}" +AWS_SHARED_CREDENTIALS_FILE="${AWS_SHARED_CREDENTIALS_FILE:-$HOME/.aws/credentials}" + function awskeys { about 'helper function for AWS credentials file' group 'aws' - if [[ ! -f ~/.aws/credentials ]]; then + if [[ ! -f "${AWS_SHARED_CREDENTIALS_FILE}" ]]; then echo "AWS credentials file not found" return 1 fi @@ -35,14 +38,14 @@ function __awskeys_help { } function __awskeys_get { - local ln=$(grep -n "\[ *$1 *\]" ~/.aws/credentials | cut -d ":" -f 1) + local ln=$(grep -n "\[ *$1 *\]" "${AWS_SHARED_CREDENTIALS_FILE}" | cut -d ":" -f 1) if [[ -n "${ln}" ]]; then - tail -n +${ln} ~/.aws/credentials | egrep -m 3 "aws_access_key_id|aws_secret_access_key|aws_session_token" + tail -n +${ln} "${AWS_SHARED_CREDENTIALS_FILE}" | egrep -m 3 "aws_access_key_id|aws_secret_access_key|aws_session_token" fi } function __awskeys_list { - local credentials_list="$((egrep '^\[ *[a-zA-Z0-9_-]+ *\]$' ~/.aws/credentials; grep "\[profile" ~/.aws/config | sed "s|\[profile |\[|g") | sort | uniq)" + local credentials_list="$((egrep '^\[ *[a-zA-Z0-9_-]+ *\]$' "${AWS_SHARED_CREDENTIALS_FILE}"; grep "\[profile" "${AWS_CONFIG_FILE}" | sed "s|\[profile |\[|g") | sort | uniq)" if [[ -n $"{credentials_list}" ]]; then echo -e "Available credentials profiles:\n" for profile in ${credentials_list}; do From f757cad45af94879bf6dfceafd12d6f79a738ea5 Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Wed, 31 Oct 2018 20:09:28 +0100 Subject: [PATCH 107/123] Add new segment, aws_profile, to powerline themes --- themes/powerline-multiline/README.md | 1 + themes/powerline-multiline/powerline-multiline.theme.bash | 3 +++ themes/powerline-naked/README.md | 1 + themes/powerline-naked/powerline-naked.theme.bash | 3 +++ themes/powerline-plain/README.md | 1 + themes/powerline-plain/powerline-plain.theme.bash | 3 +++ themes/powerline/README.md | 1 + themes/powerline/powerline.base.bash | 6 ++++++ themes/powerline/powerline.theme.bash | 3 +++ 9 files changed, 22 insertions(+) diff --git a/themes/powerline-multiline/README.md b/themes/powerline-multiline/README.md index acc199ac..ee6095dd 100644 --- a/themes/powerline-multiline/README.md +++ b/themes/powerline-multiline/README.md @@ -46,6 +46,7 @@ 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: +* `aws_profile` - Show the current value of the `AWS_PROFILE` environment variable * `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`) diff --git a/themes/powerline-multiline/powerline-multiline.theme.bash b/themes/powerline-multiline/powerline-multiline.theme.bash index 5af4dba2..ad64fb18 100644 --- a/themes/powerline-multiline/powerline-multiline.theme.bash +++ b/themes/powerline-multiline/powerline-multiline.theme.bash @@ -36,6 +36,9 @@ RBENV_THEME_PROMPT_SUFFIX="" RUBY_THEME_PROMPT_COLOR=161 RUBY_CHAR=${POWERLINE_RUBY_CHAR:="❲r❳ "} +AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }" +AWS_PROFILE_PROMPT_COLOR=208 + CWD_THEME_PROMPT_COLOR=240 LAST_STATUS_THEME_PROMPT_COLOR=196 diff --git a/themes/powerline-naked/README.md b/themes/powerline-naked/README.md index 510e0301..62238bd5 100644 --- a/themes/powerline-naked/README.md +++ b/themes/powerline-naked/README.md @@ -42,6 +42,7 @@ 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: +* `aws_profile` - Show the current value of the `AWS_PROFILE` environment variable * `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`) diff --git a/themes/powerline-naked/powerline-naked.theme.bash b/themes/powerline-naked/powerline-naked.theme.bash index 08e2a1f5..4e06273c 100644 --- a/themes/powerline-naked/powerline-naked.theme.bash +++ b/themes/powerline-naked/powerline-naked.theme.bash @@ -33,6 +33,9 @@ RBENV_THEME_PROMPT_SUFFIX="" RUBY_THEME_PROMPT_COLOR=161 RUBY_CHAR=${POWERLINE_RUBY_CHAR:="❲r❳ "} +AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }" +AWS_PROFILE_PROMPT_COLOR=208 + CWD_THEME_PROMPT_COLOR=254 LAST_STATUS_THEME_PROMPT_COLOR=124 diff --git a/themes/powerline-plain/README.md b/themes/powerline-plain/README.md index 8c8647e3..ef773cd8 100644 --- a/themes/powerline-plain/README.md +++ b/themes/powerline-plain/README.md @@ -40,6 +40,7 @@ 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: +* `aws_profile` - Show the current value of the `AWS_PROFILE` environment variable * `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`) diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash index cdcb3cc2..0757dc9e 100644 --- a/themes/powerline-plain/powerline-plain.theme.bash +++ b/themes/powerline-plain/powerline-plain.theme.bash @@ -28,6 +28,9 @@ RBENV_THEME_PROMPT_SUFFIX="" RUBY_THEME_PROMPT_COLOR=161 RUBY_CHAR=${POWERLINE_RUBY_CHAR:="💎 "} +AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }" +AWS_PROFILE_PROMPT_COLOR=208 + CWD_THEME_PROMPT_COLOR=240 LAST_STATUS_THEME_PROMPT_COLOR=52 diff --git a/themes/powerline/README.md b/themes/powerline/README.md index 7c1a135c..d3f7fbca 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -44,6 +44,7 @@ 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: +* `aws_profile` - Show the current value of the `AWS_PROFILE` environment variable * `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`) diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index 78b6d710..7dded057 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -136,6 +136,12 @@ function __powerline_in_vim_prompt { fi } +function __powerline_aws_profile_prompt { + if [[ -n "${AWS_PROFILE}" ]]; then + echo "${AWS_PROFILE_CHAR}${AWS_PROFILE}|${AWS_PROFILE_PROMPT_COLOR}" + fi +} + function __powerline_left_segment { local OLD_IFS="${IFS}"; IFS="|" local params=( $1 ) diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index d3bb242a..9f0e6f04 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -31,6 +31,9 @@ RBENV_THEME_PROMPT_SUFFIX="" RUBY_THEME_PROMPT_COLOR=161 RUBY_CHAR=${POWERLINE_RUBY_CHAR:="❲r❳ "} +AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }" +AWS_PROFILE_PROMPT_COLOR=208 + CWD_THEME_PROMPT_COLOR=240 LAST_STATUS_THEME_PROMPT_COLOR=52 From 74b1fb8185de9a6339fed7cde2e07c16b6c67ef6 Mon Sep 17 00:00:00 2001 From: Jason Al-Mansor Date: Thu, 1 Nov 2018 10:45:08 -0400 Subject: [PATCH 108/123] Fixing quotes around new docker aliases which cause them to execute --- aliases/available/docker.aliases.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aliases/available/docker.aliases.bash b/aliases/available/docker.aliases.bash index 418c6235..011135c6 100644 --- a/aliases/available/docker.aliases.bash +++ b/aliases/available/docker.aliases.bash @@ -28,6 +28,6 @@ alias dkelc='docker exec -it `dklcid` bash' # Enter last container (works with D alias dkex='docker exec -it ' # Useful to run any commands into container without leaving host # Added more recent cleanup options from newer docker versions -alias dkip=`docker image prune -a -f` -alias dkvp=`docker volume prune -f` -alias dksp=`docker system prune -a -f` +alias dkip='docker image prune -a -f' +alias dkvp='docker volume prune -f' +alias dksp='docker system prune -a -f' From b03a93cd2bf0c13bf2575ee104a0afa3080359ea Mon Sep 17 00:00:00 2001 From: "daniel.schroeder" Date: Fri, 2 Nov 2018 10:47:55 +0100 Subject: [PATCH 109/123] disable theming by checking theme var for value --- README.md | 20 ++++++++++++-------- bash_it.sh | 27 +++++++++++++++------------ template/bash_profile.template.bash | 3 ++- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index e73fc55d..13a991da 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,10 @@ When you run without the `--no-modify-config` switch, the Bash-it installer auto Use the `--no-modify-config` switch to avoid unwanted modifications, e.g. if your Bash config file already contains the code that loads Bash-it. **NOTE**: Keep in mind how Bash load its configuration files, -`.bash_profile` for login shells (and in macOS in terminal emulators like [Terminal.app](http://www.apple.com/osx/apps/) or +`.bash_profile` for login shells (and in macOS in terminal emulators like [Terminal.app](http://www.apple.com/osx/apps/) or [iTerm2](https://www.iterm2.com/)) and `.bashrc` for interactive shells (default mode in most of the GNU/Linux terminal emulators), to ensure that Bash-it is loaded correctly. -A good "practice" is sourcing `.bashrc` into `.bash_profile` to keep things working in all the scenarios. +A good "practice" is sourcing `.bashrc` into `.bash_profile` to keep things working in all the scenarios. To achieve this, you can add this snippet in your `.bash_profile`: ``` @@ -76,8 +76,8 @@ Refer to the official [Bash documentation](https://www.gnu.org/software/bash/man ### Install using Docker -You can try Bash-it in an isolated environment without changing any local files via a [Docker](https://www.docker.com/) Container. -(Bash Shell v4.4 with Bash-it, [bats](https://github.com/sstephenson/bats) and bash-completion based on [Alpine Linux](https://alpinelinux.org/)). +You can try Bash-it in an isolated environment without changing any local files via a [Docker](https://www.docker.com/) Container. +(Bash Shell v4.4 with Bash-it, [bats](https://github.com/sstephenson/bats) and bash-completion based on [Alpine Linux](https://alpinelinux.org/)). `docker pull ellerbrock/bash-it` @@ -140,7 +140,7 @@ Currently enabled modules will be shown in green. ### Searching with Negations -You can prefix a search term with a "-" to exclude it from the results. +You can prefix a search term with a "-" to exclude it from the results. In the above example, if we wanted to hide `chruby` and `chruby-auto`, we could change the command as follows: @@ -189,6 +189,7 @@ There are over 50+ Bash-it themes to pick from in `$BASH_IT/themes`. The default theme is `bobby`. Set `BASH_IT_THEME` to the theme name you want, or if you've developed your own custom theme outside of `$BASH_IT/themes`, point the `BASH_IT_THEME` variable directly to the theme file. +To disable theming completely, leave the variable empty. Examples: @@ -198,6 +199,9 @@ export BASH_IT_THEME="powerline-multiline" # Use a theme outside of the Bash-it folder export BASH_IT_THEME="/home/foo/my_theme/my_theme.theme.bash" + +# Disable theming +export BASH_IT_THEME="" ``` You can easily preview the themes in your own shell using `BASH_PREVIEW=true bash-it reload`. @@ -294,8 +298,8 @@ Set `SCM_GIT_SHOW_REMOTE_INFO` to 'false' to **disable the feature**: ### Untracked files -By default, the `git status` command shows information about *untracked* files. -This behavior can be controlled through command-line flags or git configuration files. +By default, the `git status` command shows information about *untracked* files. +This behavior can be controlled through command-line flags or git configuration files. For big repositories, ignoring *untracked* files can make git faster. Bash-it uses `git status` to gather the repo information it shows in the prompt, so in some circumstances, it can be useful to instruct Bash-it to ignore these files. You can control this behavior with the flag `SCM_GIT_IGNORE_UNTRACKED`: @@ -346,7 +350,7 @@ You can control the prefix and the suffix of this component using the two variab And -* `export SCM_THEME_CURRENT_USER_SUFFIX=' ☺︎ '` +* `export SCM_THEME_CURRENT_USER_SUFFIX=' ☺︎ '` **NOTE:** If using `SCM_GIT_SHOW_MINIMAL_INFO=true`, then the value of `SCM_GIT_SHOW_CURRENT_USER` is ignored. diff --git a/bash_it.sh b/bash_it.sh index 8eea4c6a..e2b00de7 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -46,19 +46,22 @@ do _load_bash_it_files $file_type done -# Load colors and helpers first so they can be used in base theme -# shellcheck source=./themes/colors.theme.bash -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" +# Load theme, if a theme was set +if [[ ! -z "${BASH_IT_THEME}" ]]; then + # Load colors and helpers first so they can be used in base theme + # shellcheck source=./themes/colors.theme.bash + 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" -# appearance (themes) now, after all dependencies -# shellcheck source=./lib/appearance.bash -source "$APPEARANCE_LIB" + # appearance (themes) now, after all dependencies + # shellcheck source=./lib/appearance.bash + source "$APPEARANCE_LIB" +fi # Load custom aliases, completion, plugins for file_type in "aliases" "completion" "plugins" diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index 01097960..5e877900 100755 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -3,7 +3,8 @@ # Path to the bash it configuration export BASH_IT="{{BASH_IT}}" -# Lock and Load a custom theme file +# Lock and Load a custom theme file. +# Leave empty to disable theming. # location /.bash_it/themes/ export BASH_IT_THEME='bobby' From b3f7de38937a12cfd0cef6eb40069dc7d91b529c Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Sun, 11 Nov 2018 14:14:02 +0100 Subject: [PATCH 110/123] Support XDG in fzf plugin --- plugins/available/fzf.plugin.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/available/fzf.plugin.bash b/plugins/available/fzf.plugin.bash index f2eddeb1..def60825 100644 --- a/plugins/available/fzf.plugin.bash +++ b/plugins/available/fzf.plugin.bash @@ -4,7 +4,11 @@ cite about-plugin about-plugin 'load fzf, if you are using it' -[ -f ~/.fzf.bash ] && source ~/.fzf.bash +if [ -f ~/.fzf.bash ]; then + source ~/.fzf.bash +elif [ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash ]; then + source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash +fi if [ -z ${FZF_DEFAULT_COMMAND+x} ]; then command -v fd &> /dev/null && export FZF_DEFAULT_COMMAND='fd --type f' From 4df44b1fa998d44819a84477f8685f12ecab7e1d Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Mon, 12 Nov 2018 22:59:14 +0100 Subject: [PATCH 111/123] Bash-it don't returns to the previous path after update --- lib/helpers.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index a2c0d3aa..565173ed 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -167,6 +167,8 @@ _bash-it_update() { _about 'updates Bash-it' _group 'lib' + local old_pwd="${PWD}" + cd "${BASH_IT}" || return if [ -z $BASH_IT_REMOTE ]; then @@ -194,7 +196,7 @@ _bash-it_update() { else echo "Bash-it is up to date, nothing to do!" fi - cd - &> /dev/null || return + cd "${old_pwd}" &> /dev/null || return } _bash-it-migrate() { From 7e26ae28bf2cf47ea62d3acf0bde5f8ca0ffad0a Mon Sep 17 00:00:00 2001 From: Jeremy Mathevet Date: Tue, 13 Nov 2018 11:25:59 +0000 Subject: [PATCH 112/123] Add kubernetes-context segment to powerline --- themes/base.theme.bash | 4 ++++ themes/powerline-naked/README.md | 4 +++- themes/powerline-naked/powerline-naked.theme.bash | 3 +++ themes/powerline-plain/README.md | 4 +++- themes/powerline-plain/powerline-plain.theme.bash | 3 +++ themes/powerline/README.md | 4 +++- themes/powerline/powerline.base.bash | 10 ++++++++++ themes/powerline/powerline.theme.bash | 3 +++ 8 files changed, 32 insertions(+), 3 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 51d5f359..e4879f3c 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -336,6 +336,10 @@ function ruby_version_prompt { echo -e "$(rbfu_version_prompt)$(rbenv_version_prompt)$(rvm_version_prompt)$(chruby_version_prompt)" } +function k8s_context_prompt { + echo -e "$(kubectl config current-context)" +} + function virtualenv_prompt { if [[ -n "$VIRTUAL_ENV" ]]; then virtualenv=`basename "$VIRTUAL_ENV"` diff --git a/themes/powerline-naked/README.md b/themes/powerline-naked/README.md index 62238bd5..da5e254b 100644 --- a/themes/powerline-naked/README.md +++ b/themes/powerline-naked/README.md @@ -14,6 +14,7 @@ A colorful theme, where shows a lot information about your shell session. * An indicator when the current shell is inside the Vim editor * Battery charging status (depends on the [../../plugins/available/battery.plugin.bash](battery plugin)) * SCM Repository status (e.g. Git, SVN) +* The current Kubernetes environment * The current Python environment (Virtualenv, venv, and Conda are supported) in use * The current Ruby environment (rvm and rbenv are supported) in use * Last command exit code (only shown when the exit code is greater than 0) @@ -48,11 +49,12 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `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 +* `k8s_context` - Show current kubernetes context * `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` +* `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. diff --git a/themes/powerline-naked/powerline-naked.theme.bash b/themes/powerline-naked/powerline-naked.theme.bash index 4e06273c..81025c84 100644 --- a/themes/powerline-naked/powerline-naked.theme.bash +++ b/themes/powerline-naked/powerline-naked.theme.bash @@ -33,6 +33,9 @@ RBENV_THEME_PROMPT_SUFFIX="" RUBY_THEME_PROMPT_COLOR=161 RUBY_CHAR=${POWERLINE_RUBY_CHAR:="❲r❳ "} +KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} +KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=26 + AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }" AWS_PROFILE_PROMPT_COLOR=208 diff --git a/themes/powerline-plain/README.md b/themes/powerline-plain/README.md index ef773cd8..701b9fa1 100644 --- a/themes/powerline-plain/README.md +++ b/themes/powerline-plain/README.md @@ -12,6 +12,7 @@ A colorful theme, where shows a lot information about your shell session. * An indicator when the current shell is inside the Vim editor * Battery charging status (depends on the [../../plugins/available/battery.plugin.bash](battery plugin)) * SCM Repository status (e.g. Git, SVN) +* The current Kubernetes environment * The current Python environment (Virtualenv, venv, and Conda are supported) in use * The current Ruby environment (rvm and rbenv are supported) in use * Last command exit code (only shown when the exit code is greater than 0) @@ -46,11 +47,12 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `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 +* `k8s_context` - Show current kubernetes context * `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` +* `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. diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash index 0757dc9e..bddb6450 100644 --- a/themes/powerline-plain/powerline-plain.theme.bash +++ b/themes/powerline-plain/powerline-plain.theme.bash @@ -28,6 +28,9 @@ RBENV_THEME_PROMPT_SUFFIX="" RUBY_THEME_PROMPT_COLOR=161 RUBY_CHAR=${POWERLINE_RUBY_CHAR:="💎 "} +KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} +KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=26 + AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }" AWS_PROFILE_PROMPT_COLOR=208 diff --git a/themes/powerline/README.md b/themes/powerline/README.md index d3f7fbca..974bcbeb 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -16,6 +16,7 @@ A colorful theme, where shows a lot information about your shell session. * An indicator when the current shell is inside the Vim editor * Battery charging status (depends on the [../../plugins/available/battery.plugin.bash](battery plugin)) * SCM Repository status (e.g. Git, SVN) +* The current Kubernetes environment * The current Python environment (Virtualenv, venv, and Conda are supported) in use * The current Ruby environment (rvm and rbenv are supported) in use * Last command exit code (only shown when the exit code is greater than 0) @@ -50,11 +51,12 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `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 +* `k8s_context` - Show current kubernetes context * `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` +* `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. diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index 7dded057..08da5f7c 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -52,6 +52,16 @@ function __powerline_ruby_prompt { [[ -n "${ruby_version}" ]] && echo "${RUBY_CHAR}${ruby_version}|${RUBY_THEME_PROMPT_COLOR}" } +function __powerline_k8s_context_prompt { + local kubernetes_context="" + + if _command_exists kubectl; then + kubernetes_context="$(k8s_context_prompt)" + fi + + [[ -n "${kubernetes_context}" ]] && echo "${KUBERNETES_CONTEXT_THEME_CHAR}${kubernetes_context}|${KUBERNETES_CONTEXT_THEME_PROMPT_COLOR}" +} + function __powerline_python_venv_prompt { set +u local python_venv="" diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index 9f0e6f04..482b3464 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -31,6 +31,9 @@ RBENV_THEME_PROMPT_SUFFIX="" RUBY_THEME_PROMPT_COLOR=161 RUBY_CHAR=${POWERLINE_RUBY_CHAR:="❲r❳ "} +KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} +KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=26 + AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }" AWS_PROFILE_PROMPT_COLOR=208 From 75564a050f5fb738cb35cdf03239418d9dbdfab8 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Thu, 15 Nov 2018 10:35:17 +0200 Subject: [PATCH 113/123] Add completions for Opscode Chef's knife command --- completion/available/knife.completion.bash | 207 +++++++++++++++++++++ 1 file changed, 207 insertions(+) create mode 100644 completion/available/knife.completion.bash diff --git a/completion/available/knife.completion.bash b/completion/available/knife.completion.bash new file mode 100644 index 00000000..6316ce08 --- /dev/null +++ b/completion/available/knife.completion.bash @@ -0,0 +1,207 @@ +#!/usr/bin/env bash + +############## +### CONFIG ### +############## +### feel free to change those constants +# the dir where to store the cache (must be writable and readable by the current user) +# must be an absolute path +_KNIFE_AUTOCOMPLETE_CACHE_DIR="$HOME/.knife_autocomplete_cache" +# the maximum # of _seconds_ after which a cache will be considered stale +# (a cache is refreshed whenever it is used! this is only for caches that might not have been used for a long time) +# WARNING: keep that value > 100 +_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE=86400 + +############################################### +### END OF CONFIG - DON'T CHANGE CODE BELOW ### +############################################### + +### init +_KAC_CACHE_TMP_DIR="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/tmp" +# make sure the cache dir exists +mkdir -p $_KAC_CACHE_TMP_DIR + +############################## +### Cache helper functions ### +############################## + +# GNU or BSD stat? +stat -c %Y /dev/null > /dev/null 2>&1 && _KAC_STAT_COMMAND="stat -c %Y" || _KAC_STAT_COMMAND="stat -f %m" + +# returns 0 iff the file whose path is given as 1st argument +# exists and has last been modified in the last $2 seconds +# returns 1 otherwise +_KAC_is_file_newer_than() +{ + [ -f "$1" ] || return 1 + [ $(( $(date +%s) - $($_KAC_STAT_COMMAND "$1") )) -gt $2 ] && return 1 || return 0 +} + +# helper function for _KAC_get_and_regen_cache, see doc below +_KAC_regen_cache() +{ + local CACHE_NAME=$1 + local CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME" + local TMP_FILE=$(mktemp "$_KAC_CACHE_TMP_DIR/$CACHE_NAME.XXXX") + shift 1 + "$@" > $TMP_FILE 2> /dev/null + # discard the temp file if it's empty AND the previous command didn't exit successfully, but still mark the cache as updated + [[ $? != 0 ]] && [[ $(cat $TMP_FILE | wc -l) == 0 ]] && rm -f $TMP_FILE && touch $CACHE_PATH && return 1 \ + || mv -f $TMP_FILE $CACHE_PATH +} + +# cached files can't have spaces in their names +_KAC_get_cache_name_from_command() +{ + echo "$@" | sed 's/ /_SPACE_/g' +} + +# the reverse operation from the function above +_KAC_get_command_from_cache_name() +{ + echo "$@" | sed 's/_SPACE_/ /g' +} + +# given a command as argument, it fetches the cache for that command if it can find it +# otherwise it waits for the cache to be generated +# in either case, it regenerates the cache, and sets the _KAC_CACHE_PATH env variable +# for obvious reason, do NOT call that in a sub-shell (in particular, no piping) +_KAC_get_and_regen_cache() +{ + # the cache name can't have space in it + local CACHE_NAME=$(_KAC_get_cache_name_from_command "$@") + local REGEN_CMD="_KAC_regen_cache $CACHE_NAME $@" + _KAC_CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME" + # no need to wait for the regen if the file already exists + [ -f $_KAC_CACHE_PATH ] && ($REGEN_CMD &) || $REGEN_CMD +} + +# performs two things: first, deletes all obsolete temp files +# then refreshes stale caches that haven't been called in a long time +_KAC_clean_cache() +{ + local FILE CMD + # delete all obsolete temp files, could be lingering there for any kind of crash in the caching process + for FILE in $(ls $_KAC_CACHE_TMP_DIR) + do + _KAC_is_file_newer_than $FILE $_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE || rm -f $FILE + done + # refresh really stale caches + for FILE in $(find $_KNIFE_AUTOCOMPLETE_CACHE_DIR -maxdepth 1 -type f -not -name '.*') + do + _KAC_is_file_newer_than $FILE $_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE && continue + # first let's get the original command + CMD=$(_KAC_get_command_from_cache_name $(basename "$FILE")) + # then regen the cache + _KAC_get_and_regen_cache "$CMD" > /dev/null + done +} + +# perform a cache cleaning when loading this file +_KAC_clean_cache + +##################################### +### End of cache helper functions ### +##################################### + + +# returns all the possible knife sub-commands +_KAC_knife_commands() +{ + knife --help | grep -E "^knife" | sed -E 's/ \(options\)//g' +} + +# rebuilds the knife base command currently being completed, and assigns it to $_KAC_CURRENT_COMMAND +# additionnally, returns 1 iff the current base command is not complete, 0 otherwise +# also sets $_KAC_CURRENT_COMMAND_NB_WORDS if the base command is complete +_KAC_get_current_base_command() +{ + local PREVIOUS="knife" + local I=1 + local CURRENT + while [ $I -le $COMP_CWORD ] + do + # command words are all lower-case + echo ${COMP_WORDS[$I]} | grep -E "^[a-z]+$" > /dev/null || break + CURRENT="$PREVIOUS ${COMP_WORDS[$I]}" + cat $_KAC_CACHE_PATH | grep -E "^$CURRENT" > /dev/null || break + PREVIOUS=$CURRENT + I=$(( $I + 1)) + done + _KAC_CURRENT_COMMAND=$PREVIOUS + [ $I -le $COMP_CWORD ] && _KAC_CURRENT_COMMAND_NB_WORDS=$I +} + +# searches the position of the currently completed argument in the current base command +# (i.e. handles "plural" arguments such as knife cookbook upload cookbook1 cookbook2 and so on...) +# assumes the current base command is complete +_KAC_get_current_arg_position() +{ + local CURRENT_ARG_POS=$(( $_KAC_CURRENT_COMMAND_NB_WORDS + 1 )) + local COMPLETE_COMMAND=$(cat $_KAC_CACHE_PATH | grep -E "^$_KAC_CURRENT_COMMAND") + local CURRENT_ARG + while [ $CURRENT_ARG_POS -le $COMP_CWORD ] + do + CURRENT_ARG=$(echo $COMPLETE_COMMAND | cut -d ' ' -f $CURRENT_ARG_POS) + # we break if the current arg is a "plural" arg + echo $CURRENT_ARG | grep -E "^\\[[^]]+(\\.\\.\\.\\]|$)" > /dev/null && break + CURRENT_ARG_POS=$(( $CURRENT_ARG_POS + 1 )) + done + echo $CURRENT_ARG_POS +} + +# the actual auto-complete function +_knife() +{ + _KAC_get_and_regen_cache _KAC_knife_commands + local RAW_LIST ITEM REGEN_CMD ARG_POSITION + COMREPLY=() + # get correct command & arg pos + _KAC_get_current_base_command && ARG_POSITION=$(_KAC_get_current_arg_position) || ARG_POSITION=$(( $COMP_CWORD + 1 )) + RAW_LIST=$(cat $_KAC_CACHE_PATH | grep -E "^$_KAC_CURRENT_COMMAND" | cut -d ' ' -f $ARG_POSITION | uniq) + + # we need to process that raw list a bit, most notably for placeholders + # NOTE: I chose to explicitely fetch & cache _certain_ informations for the server (cookbooks & node names, etc) + # as opposed to a generic approach by trying to find a 'list' knife command corresponding to the + # current base command - that might limit my script in some situation, but that way I'm sure it caches only + # not-sensitive stuff (a generic approach could be pretty bad e.g. with the knife-rackspace plugin) + LIST="" + for ITEM in $RAW_LIST + do + # always relevant if only lower-case chars : continuation of the base command + echo $ITEM | grep -E "^[a-z]+$" > /dev/null && LIST="$LIST $ITEM" && continue + case $ITEM in + *COOKBOOK*) + # special case for cookbooks : from site or local + [[ ${COMP_WORDS[2]} == 'site' ]] && REGEN_CMD="knife cookbook site list" || REGEN_CMD="knife cookbook list" + _KAC_get_and_regen_cache $REGEN_CMD + LIST="$LIST $(cat $_KAC_CACHE_PATH | cut -d ' ' -f 1)" + continue + ;; + *ITEM*) + # data bag item : another special case + local DATA_BAG_NAME=${COMP_WORDS[$(( COMP_CWORD-1 ))]} + REGEN_CMD="knife data bag show $DATA_BAG_NAME" + ;; + *INDEX*) + # see doc @ http://docs.opscode.com/knife_search.html + LIST="$LIST client environment node role" + REGEN_CMD="knife data bag list" + ;; + *BAG*) REGEN_CMD="knife data bag list";; + *CLIENT*) REGEN_CMD="knife client list";; + *NODE*) REGEN_CMD="knife node list";; + *ENVIRONMENT*) REGEN_CMD="knife environment list";; + *ROLE*) REGEN_CMD="knife role list";; + *USER*) REGEN_CMD="knife user list";; + # not a generic argument we support... + *) continue;; + esac + _KAC_get_and_regen_cache $REGEN_CMD + LIST="$LIST $(cat $_KAC_CACHE_PATH)" + done + COMPREPLY=( $(compgen -W "${LIST}" -- ${COMP_WORDS[COMP_CWORD]})) +} + +#complete -f -F _knife knife +complete -F _knife knife From 96819ba7f30e2a1f62c9518da9dbcd7f16396511 Mon Sep 17 00:00:00 2001 From: Tony Feng <337940626@qq.com> Date: Thu, 15 Nov 2018 16:57:08 +0800 Subject: [PATCH 114/123] fix the phoenix mix command -> 'phoenx' to 'phx'. --- aliases/available/phoenix.aliases.bash | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/aliases/available/phoenix.aliases.bash b/aliases/available/phoenix.aliases.bash index 2a4ec5e1..64728a2e 100644 --- a/aliases/available/phoenix.aliases.bash +++ b/aliases/available/phoenix.aliases.bash @@ -3,7 +3,7 @@ about-alias 'phoenix abbreviations' # Phoenix Commands alias i='iex' -alias ips='iex -S mix phoenix.server' +alias ips='iex -S mix phx.server' alias ism='iex -S mix' alias m='mix' alias mab='mix archive.build' @@ -32,14 +32,14 @@ alias mho='mix hex.outdated' alias mlh='mix local.hex' alias mn='mix new' alias mns='mix new --sup' -alias mpgc='mix phoenix.gen.channel' -alias mpgh='mix phoenix.gen.html' -alias mpgj='mix phoenix.gen.json' -alias mpgm='mix phoenix.gen.model' -alias mpgs='mix phoenix.gen.secret' -alias mpn='mix phoenix.new' -alias mpr='mix phoenix.routes' -alias mps='mix phoenix.server' +alias mpgc='mix phx.gen.channel' +alias mpgh='mix phx.gen.html' +alias mpgj='mix phx.gen.json' +alias mpgm='mix phx.gen.model' +alias mpgs='mix phx.gen.secret' +alias mpn='mix phx.new' +alias mpr='mix phx.routes' +alias mps='mix phx.server' alias mr='mix run' alias mrnh='mix run --no-halt' alias mrl='mix release' From 05529dbd6b29ee273900fa386ccfff7c9a159822 Mon Sep 17 00:00:00 2001 From: Matthew Adams Date: Tue, 20 Nov 2018 07:59:16 -0600 Subject: [PATCH 115/123] more docker aliases --- aliases/available/docker.aliases.bash | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aliases/available/docker.aliases.bash b/aliases/available/docker.aliases.bash index 011135c6..e7738882 100644 --- a/aliases/available/docker.aliases.bash +++ b/aliases/available/docker.aliases.bash @@ -26,6 +26,10 @@ alias dkideps='docker-image-dependencies' # Output a graph of image dependencie alias dkre='docker-runtime-environment' # List environmental variables of the supplied image ID alias dkelc='docker exec -it `dklcid` bash' # Enter last container (works with Docker 1.3 and above) alias dkex='docker exec -it ' # Useful to run any commands into container without leaving host +alias dkri='docker run --rm -i ' +alias dkrit='docker run --rm -it ' +alias dkalp='docker run --rm -it alpine' +alias dkubu='docker run --rm -it ubuntu' # Added more recent cleanup options from newer docker versions alias dkip='docker image prune -a -f' From 1f80b1147683e91cbb3058986babee984567366b Mon Sep 17 00:00:00 2001 From: Matthew Adams Date: Tue, 20 Nov 2018 09:29:15 -0600 Subject: [PATCH 116/123] more aliases --- aliases/available/docker.aliases.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aliases/available/docker.aliases.bash b/aliases/available/docker.aliases.bash index e7738882..c002f17d 100644 --- a/aliases/available/docker.aliases.bash +++ b/aliases/available/docker.aliases.bash @@ -1,6 +1,8 @@ cite 'about-alias' about-alias 'docker abbreviations' +alias d='docker' +alias dk='docker' alias dklc='docker ps -l' # List last Docker container alias dklcid='docker ps -l -q' # List last Docker container ID alias dklcip='docker inspect -f "{{.NetworkSettings.IPAddress}}" $(docker ps -l -q)' # Get IP of last Docker container From 310ee837c9e2f635b0a36831cb7ab02c816be9ce Mon Sep 17 00:00:00 2001 From: Septian Dwic Date: Wed, 21 Nov 2018 02:05:19 +0700 Subject: [PATCH 117/123] init - bash its automatically load auto-completion --- plugins/available/jenv.plugin.bash | 4 +--- plugins/available/nodenv.plugin.bash | 5 +---- plugins/available/plenv.plugin.bash | 9 +++------ plugins/available/pyenv.plugin.bash | 7 ++----- plugins/available/rbenv.plugin.bash | 5 +---- 5 files changed, 8 insertions(+), 22 deletions(-) diff --git a/plugins/available/jenv.plugin.bash b/plugins/available/jenv.plugin.bash index 3cb2bcfc..08470688 100644 --- a/plugins/available/jenv.plugin.bash +++ b/plugins/available/jenv.plugin.bash @@ -4,6 +4,4 @@ about-plugin 'load jenv, if you are using it' export JENV_ROOT="$HOME/.jenv" pathmunge "$JENV_ROOT/bin" -if which jenv > /dev/null; then eval "$(jenv init -)"; fi - -[[ -e $JENV_ROOT/completions/jenv.bash ]] && source $JENV_ROOT/completions/jenv.bash +if which jenv > /dev/null; then eval "$(jenv init - bash)"; fi diff --git a/plugins/available/nodenv.plugin.bash b/plugins/available/nodenv.plugin.bash index f28e4045..1bbe7fbd 100644 --- a/plugins/available/nodenv.plugin.bash +++ b/plugins/available/nodenv.plugin.bash @@ -4,7 +4,4 @@ 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 +[[ `which nodenv` ]] && eval "$(nodenv init - bash)" diff --git a/plugins/available/plenv.plugin.bash b/plugins/available/plenv.plugin.bash index 1e527b72..1da2d61b 100644 --- a/plugins/available/plenv.plugin.bash +++ b/plugins/available/plenv.plugin.bash @@ -4,18 +4,15 @@ cite about-plugin about-plugin 'plenv plugin for Perl' if [[ -e "${HOME}/.plenv/bin" ]] ; then - + # load plenv bin dir into path if it exists pathmunge "${HOME}/.plenv/bin" - + fi if [[ `which plenv` ]] ; then # init plenv - eval "$(plenv init -)" - - # Load the auto-completion script if it exists. - [[ -e "${HOME}/.plenv/completions/plenv.bash" ]] && source "${HOME}/.plenv/completions/plenv.bash" + eval "$(plenv init - bash)" fi diff --git a/plugins/available/pyenv.plugin.bash b/plugins/available/pyenv.plugin.bash index 0f6bffb8..dced31a8 100644 --- a/plugins/available/pyenv.plugin.bash +++ b/plugins/available/pyenv.plugin.bash @@ -4,12 +4,9 @@ about-plugin 'load pyenv, if you are using it' export PYENV_ROOT="$HOME/.pyenv" pathmunge "$PYENV_ROOT/bin" -[[ `which pyenv` ]] && eval "$(pyenv init -)" +[[ `which pyenv` ]] && eval "$(pyenv init - bash)" #Load pyenv virtualenv if the virtualenv plugin is installed. if pyenv virtualenv-init - &> /dev/null; then - eval "$(pyenv virtualenv-init -)" + eval "$(pyenv virtualenv-init - bash)" fi - -# Load the auto-completion script if pyenv was loaded. -[[ -e $PYENV_ROOT/completions/pyenv.bash ]] && source $PYENV_ROOT/completions/pyenv.bash diff --git a/plugins/available/rbenv.plugin.bash b/plugins/available/rbenv.plugin.bash index 75d24154..ecba0c89 100644 --- a/plugins/available/rbenv.plugin.bash +++ b/plugins/available/rbenv.plugin.bash @@ -4,7 +4,4 @@ about-plugin 'load rbenv, if you are using it' export RBENV_ROOT="$HOME/.rbenv" pathmunge "$RBENV_ROOT/bin" -[[ `which rbenv` ]] && eval "$(rbenv init -)" - -# Load the auto-completion script if rbenv was loaded. -[[ -e $RBENV_ROOT/completions/rbenv.bash ]] && source $RBENV_ROOT/completions/rbenv.bash +[[ `which rbenv` ]] && eval "$(rbenv init - bash)" From 6fcb32f85143d44236ce509012dab2982e7df564 Mon Sep 17 00:00:00 2001 From: Matthew Adams Date: Sat, 24 Nov 2018 08:44:46 -0600 Subject: [PATCH 118/123] rm d, dkalp & dkubu --- aliases/available/docker.aliases.bash | 3 --- 1 file changed, 3 deletions(-) diff --git a/aliases/available/docker.aliases.bash b/aliases/available/docker.aliases.bash index c002f17d..5606b619 100644 --- a/aliases/available/docker.aliases.bash +++ b/aliases/available/docker.aliases.bash @@ -1,7 +1,6 @@ cite 'about-alias' about-alias 'docker abbreviations' -alias d='docker' alias dk='docker' alias dklc='docker ps -l' # List last Docker container alias dklcid='docker ps -l -q' # List last Docker container ID @@ -30,8 +29,6 @@ alias dkelc='docker exec -it `dklcid` bash' # Enter last container (works with D alias dkex='docker exec -it ' # Useful to run any commands into container without leaving host alias dkri='docker run --rm -i ' alias dkrit='docker run --rm -it ' -alias dkalp='docker run --rm -it alpine' -alias dkubu='docker run --rm -it ubuntu' # Added more recent cleanup options from newer docker versions alias dkip='docker image prune -a -f' From bd0c1d92c508a1f6945f7822d0c36ee0ee2c78ef Mon Sep 17 00:00:00 2001 From: icanhazstring Date: Tue, 27 Nov 2018 12:07:40 +0100 Subject: [PATCH 119/123] Add support for composer aliases --- aliases/available/composer.aliases.bash | 40 +++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 aliases/available/composer.aliases.bash diff --git a/aliases/available/composer.aliases.bash b/aliases/available/composer.aliases.bash new file mode 100644 index 00000000..4820d017 --- /dev/null +++ b/aliases/available/composer.aliases.bash @@ -0,0 +1,40 @@ +cite 'about-alias' +about-alias 'common composer abbreviations' + +# Aliases +alias cab='composer about' +alias car='composer archive' +alias cb='composer browser' +alias ccpq='composer check-platform-reqs' +alias ccc='composer clear-cache' +alias cconf='composer config' +alias ccp='composer create-project' +alias cdep='composer depends' +alias cdiag='composer diagnose' +alias cdump='composer dump-autoload' +alias cdumpo='composer dump-autoload -o' +alias cex='composer exec' +alias cglob='composer global' +alias ch='composer help' +alias chome='composer home' +alias ci='composer install' +alias cinfo='composer info' +alias cinit='composer init' +alias clic='composer license' +alias clist='composer list' +alias cout='composer outdated' +alias cp='composer prohibits' +alias crem='composer remove' +alias creq='composer require' +alias creqd='composer require --dev' +alias crs='composer run-script' +alias cs='composer search' +alias csu='composer self-update' +alias cshow='composer show' +alias cstat='composer status' +alias csugg='composer suggest' +alias cupd='composer update' +alias cupg='composer upgrade' +alias cval='composer validate' +alias cwhy='composer why' +alias cwhyn='composer why-not' From dbe4cc690f5906f18dca636fe19d96fe6bad60f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Fr=C3=B6mer?= Date: Wed, 28 Nov 2018 10:40:56 +0100 Subject: [PATCH 120/123] Change default prefix to 'co' Should resolve problem with accidental overriding global default commands like `cp` --- aliases/available/composer.aliases.bash | 71 ++++++++++++------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/aliases/available/composer.aliases.bash b/aliases/available/composer.aliases.bash index 4820d017..5ccb2e24 100644 --- a/aliases/available/composer.aliases.bash +++ b/aliases/available/composer.aliases.bash @@ -2,39 +2,38 @@ cite 'about-alias' about-alias 'common composer abbreviations' # Aliases -alias cab='composer about' -alias car='composer archive' -alias cb='composer browser' -alias ccpq='composer check-platform-reqs' -alias ccc='composer clear-cache' -alias cconf='composer config' -alias ccp='composer create-project' -alias cdep='composer depends' -alias cdiag='composer diagnose' -alias cdump='composer dump-autoload' -alias cdumpo='composer dump-autoload -o' -alias cex='composer exec' -alias cglob='composer global' -alias ch='composer help' -alias chome='composer home' -alias ci='composer install' -alias cinfo='composer info' -alias cinit='composer init' -alias clic='composer license' -alias clist='composer list' -alias cout='composer outdated' -alias cp='composer prohibits' -alias crem='composer remove' -alias creq='composer require' -alias creqd='composer require --dev' -alias crs='composer run-script' -alias cs='composer search' -alias csu='composer self-update' -alias cshow='composer show' -alias cstat='composer status' -alias csugg='composer suggest' -alias cupd='composer update' -alias cupg='composer upgrade' -alias cval='composer validate' -alias cwhy='composer why' -alias cwhyn='composer why-not' +alias coab='composer about' +alias coar='composer archive' +alias cob='composer browser' +alias cocpr='composer check-platform-reqs' +alias cocc='composer clear-cache' +alias cocfg='composer config' +alias cocp='composer create-project' +alias codp='composer depends' +alias codiag='composer diagnose' +alias codmp='composer dump-autoload' +alias coex='composer exec' +alias coglob='composer global' +alias coh='composer help' +alias cohome='composer home' +alias coi='composer install' +alias coinf='composer info' +alias coini='composer init' +alias coli='composer license' +alias colis='composer list' +alias coout='composer outdated' +alias cop='composer prohibits' +alias corem='composer remove' +alias coreq='composer require' +alias coreqd='composer require --dev' +alias cors='composer run-script' +alias cos='composer search' +alias cosu='composer self-update' +alias coshow='composer show' +alias costat='composer status' +alias cosugg='composer suggest' +alias coup='composer update' +alias coupg='composer upgrade' +alias coval='composer validate' +alias cowhy='composer why' +alias cowhyn='composer why-not' From 8e7a566d96e59440dfc06f7568fbc9a0e1374567 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Sun, 2 Dec 2018 10:16:33 -0600 Subject: [PATCH 121/123] Show update prompt when running bash-it update This utilizes the body of the merged PR requests to show the commits that are included in this update. It gives the user a chance to decline the upgrades by pressing n or N. --- lib/helpers.bash | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index 565173ed..5652a2b8 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -181,18 +181,31 @@ _bash-it_update() { status="$(git rev-list master..${BASH_IT_REMOTE}/master 2> /dev/null)" if [[ -n "${status}" ]]; then - git pull --rebase &> /dev/null - if [[ $? -eq 0 ]]; then - echo "Bash-it successfully updated." - echo "" - echo "Migrating your installation to the latest version now..." - _bash-it-migrate - echo "" - echo "All done, enjoy!" - bash-it reload - else - echo "Error updating Bash-it, please, check if your Bash-it installation folder (${BASH_IT}) is clean." - fi + git log --merges --format="%h: %b (%an)" master..${BASH_IT_REMOTE}/master + echo "" + read -e -n 1 -p "Would you like to update to $(git log -1 --format=%h origin/master)? [Y/n] " RESP + case $RESP in + [yY]|"") + git pull --rebase &> /dev/null + if [[ $? -eq 0 ]]; then + echo "Bash-it successfully updated." + echo "" + echo "Migrating your installation to the latest version now..." + _bash-it-migrate + echo "" + echo "All done, enjoy!" + bash-it reload + else + echo "Error updating Bash-it, please, check if your Bash-it installation folder (${BASH_IT}) is clean." + fi + ;; + [nN]) + echo "Not upgrading…" + ;; + *) + echo -e "\033[91mPlease choose y or n.\033[m" + ;; + esac else echo "Bash-it is up to date, nothing to do!" fi From 185c2879d56637babc4aae2eba8a20ecb9977752 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Sun, 2 Dec 2018 10:47:37 -0600 Subject: [PATCH 122/123] Update to show the subject if the body is empty --- lib/helpers.bash | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index 5652a2b8..4cc2d574 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -181,7 +181,16 @@ _bash-it_update() { status="$(git rev-list master..${BASH_IT_REMOTE}/master 2> /dev/null)" if [[ -n "${status}" ]]; then - git log --merges --format="%h: %b (%an)" master..${BASH_IT_REMOTE}/master + + for i in $(git rev-list --merges master..${BASH_IT_REMOTE}); do + num_of_lines=$(git log -1 --format=%B $i | awk 'NF' | wc -l) + if [ $num_of_lines -eq 1 ]; then + description="%s" + else + description="%b" + fi + git log --format="%h: $description (%an)" -1 $i + done echo "" read -e -n 1 -p "Would you like to update to $(git log -1 --format=%h origin/master)? [Y/n] " RESP case $RESP in From 6706814dbc36d9974e497d382a1bf57297235364 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Sun, 2 Dec 2018 20:44:00 -0600 Subject: [PATCH 123/123] Adjust so this only runs when Homebrew is installed (thanks @nwinkler) --- completion/available/crystal.completion.bash | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/completion/available/crystal.completion.bash b/completion/available/crystal.completion.bash index b83be253..cbc891d7 100644 --- a/completion/available/crystal.completion.bash +++ b/completion/available/crystal.completion.bash @@ -1,8 +1,11 @@ if which crystal >/dev/null 2>&1; then - BREW_PREFIX=$(brew --prefix) - if [ -f "$BREW_PREFIX"/etc/bash_completion.d/crystal ]; then - . "$BREW_PREFIX"/etc/bash_completion.d/crystal + if which brew >/dev/null 2>&1; then + BREW_PREFIX=$(brew --prefix) + + if [ -f "$BREW_PREFIX"/etc/bash_completion.d/crystal ]; then + . "$BREW_PREFIX"/etc/bash_completion.d/crystal + fi fi fi