From 5f2a4b5d8b15a373058f9b9960cf099eb334bdd7 Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Sun, 13 Nov 2016 00:55:55 +0100 Subject: [PATCH 01/53] Fix search command for RedHat based distributions --- lib/search.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/search.bash b/lib/search.bash index aa9a13ea..f643ad12 100644 --- a/lib/search.bash +++ b/lib/search.bash @@ -86,7 +86,7 @@ _bash-it-search-component() { fi done - local _grep=$(which egrep || which grep) + local _grep=$((which --skip-alias grep 2> /dev/null || which grep) | tail -n 1) declare -a terms=($@) # passed on the command line declare -a matches=() # results that we found @@ -98,7 +98,7 @@ _bash-it-search-component() { [[ "${term:0:1}" == "-" ]] && negative_terms=(${negative_terms[@]} ${term:1}) && continue # print asterisk next to each result that is already enabled by the user - local term_match=($(echo "${help}"| ${_grep} -i -- ${term} | egrep '\[( |x)\]' | cut -b -30 | sed 's/ *\[ \]//g;s/ *\[x\]/*/g;' )) + local term_match=($(echo "${help}"| ${_grep} -i -- ${term} | ${_grep} -E '\[( |x)\]' | cut -b -30 | sed 's/ *\[ \]//g;s/ *\[x\]/*/g;' )) [[ "${#term_match[@]}" -gt 0 ]] && { matches=(${matches[@]} ${term_match[@]}) # append to the list of results } From 8669576493a1dc730f21da54e8c12c0ccff88f0f Mon Sep 17 00:00:00 2001 From: Ilan Erenstein Date: Thu, 15 Dec 2016 11:31:30 -0800 Subject: [PATCH 02/53] Adding latest vault completion from https://github.com/iljaweis/vault-bash-completion --- completion/available/vault.completion.bash | 43 +++++++++++++++------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/completion/available/vault.completion.bash b/completion/available/vault.completion.bash index d25d9850..838a0580 100644 --- a/completion/available/vault.completion.bash +++ b/completion/available/vault.completion.bash @@ -1,34 +1,49 @@ -# Credit https://github.com/iljaweis/vault-bash-completion/ +# --------------------------------------------------------------------------- +# vault-bash-completion +# +# This adds bash completions for [HashiCorp Vault](https://www.vaultproject.io/) +# +# see https://github.com/iljaweis/vault-bash-completion +# --------------------------------------------------------------------------- + +function _vault_mounts() { + ( + set -euo pipefail + if ! vault mounts 2> /dev/null | awk 'NR > 1 {print $1}'; then + echo "secret" + fi + ) +} function _vault() { - local VAULT_COMMANDS='delete path-help read renew revoke server status write audit-disable audit-enable audit-list auth auth-disable auth-enable capabilities generate-root init key-status list mount mount-tune mounts policies policy-delete policy-write rekey remount rotate seal ssh step-down token-create token-lookup token-renew token-revoke unmount unseal version' - # get root paths - vault mounts >/dev/null 2>&1 - if [ $? != 0 ]; then - # we do not have access to list mounts - local VAULT_ROOTPATH="secret" - else - local VAULT_ROOTPATH=$(vault mounts | tail -n +2 | awk '{print $1}' | paste -s -d ' ' -) + local cur + local prev + + if [ $COMP_CWORD -gt 0 ]; then + cur=${COMP_WORDS[COMP_CWORD]} + prev=${COMP_WORDS[COMP_CWORD-1]} fi - local cur=${COMP_WORDS[COMP_CWORD]} local line=${COMP_LINE} - if [ "$(echo $line | wc -w)" -le 2 ]; then + if [[ $prev =~ ^(policies|policy-write|policy-delete) ]]; then + local policies=$(vault policies 2> /dev/null) + COMPREPLY=($(compgen -W "$policies" -- $cur)) + elif [ "$(echo $line | wc -w)" -le 2 ]; then if [[ "$line" =~ ^vault\ (read|write|delete|list)\ $ ]]; then - COMPREPLY=($(compgen -W "$VAULT_ROOTPATH" -- '')) + COMPREPLY=($(compgen -W "$(_vault_mounts)" -- '')) else COMPREPLY=($(compgen -W "$VAULT_COMMANDS" -- $cur)) fi elif [[ "$line" =~ ^vault\ (read|write|delete|list)\ (.*)$ ]]; then path=${BASH_REMATCH[2]} if [[ "$path" =~ ^([^ ]+)/([^ /]*)$ ]]; then - list=$(vault list ${BASH_REMATCH[1]} | tail -n +2) + list=$(vault list -format=yaml ${BASH_REMATCH[1]} 2> /dev/null | awk '{ print $2 }') COMPREPLY=($(compgen -W "$list" -P "${BASH_REMATCH[1]}/" -- ${BASH_REMATCH[2]})) else - COMPREPLY=($(compgen -W "$VAULT_ROOTPATH" -- $path)) + COMPREPLY=($(compgen -W "$(_vault_mounts)" -- $path)) fi fi } From da0b610a57fcaa30db4ab299cea169d10154abb6 Mon Sep 17 00:00:00 2001 From: Evan McQuinn Date: Fri, 16 Dec 2016 11:13:17 -0700 Subject: [PATCH 03/53] Add a plugin that makes it easier to use the gradle wrapper if a project has one. --- plugins/available/gradle.plugin.bash | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 plugins/available/gradle.plugin.bash diff --git a/plugins/available/gradle.plugin.bash b/plugins/available/gradle.plugin.bash new file mode 100644 index 00000000..387f5fd5 --- /dev/null +++ b/plugins/available/gradle.plugin.bash @@ -0,0 +1,22 @@ +cite about-plugin +about-plugin 'Add a gw command to use gradle wrapper if present, else use system gradle' + +function gw() { + local file="gradlew" + local curr_path="${PWD}" + local result="gradle" + + # Search recursively upwards for file. + until [[ "${curr_path}" == "/" ]]; do + if [[ -e "${curr_path}/${file}" ]]; then + result="${curr_path}/${file}" + break + else + curr_path=$(dirname "${curr_path}") + fi + done + + # Call gradle + "${result}" $* +} + From d057865c242bd6faabcc1ffe2b33e73b9a97bdf6 Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Wed, 21 Dec 2016 10:20:36 +0100 Subject: [PATCH 04/53] Add Makefile completion Sometimes, Makefile won't be completed (as for me on Fedora 25) as soon as bash-it is activated. This completion script can provide a Makefile completion. --- completion/available/makefile.completion.bash | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 completion/available/makefile.completion.bash diff --git a/completion/available/makefile.completion.bash b/completion/available/makefile.completion.bash new file mode 100644 index 00000000..c2a833ac --- /dev/null +++ b/completion/available/makefile.completion.bash @@ -0,0 +1,3 @@ +# Add completion for Makefile +# see http://stackoverflow.com/a/38415982/1472048 +complete -W "\`grep -oE '^[a-zA-Z0-9_-]+:([^=]|$)' Makefile | sed 's/[^a-zA-Z0-9_-]*$//'\`" make From d72dbd5d294b55962d68b20290df795666228346 Mon Sep 17 00:00:00 2001 From: Motasem Salem Date: Wed, 21 Dec 2016 22:14:12 -0500 Subject: [PATCH 05/53] Fixed a typo --- template/bash_profile.template.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index e9032051..1822ada5 100755 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -27,7 +27,7 @@ export TODO="t" export SCM_CHECK=true # Set Xterm/screen/Tmux title with only a short hostname. -# Unomment this (or set SHORT_HOSTNAME to something else), +# Uncomment this (or set SHORT_HOSTNAME to something else), # Will otherwise fall back on $HOSTNAME. #export SHORT_HOSTNAME=$(hostname -s) From f772ebef4a57cfecd8f47a5684073f7c2c9975ad Mon Sep 17 00:00:00 2001 From: MunifTanjim Date: Sun, 25 Dec 2016 13:15:50 +0600 Subject: [PATCH 06/53] add completion for composer --- completion/available/composer.completion.bash | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 completion/available/composer.completion.bash diff --git a/completion/available/composer.completion.bash b/completion/available/composer.completion.bash new file mode 100644 index 00000000..be19fd27 --- /dev/null +++ b/completion/available/composer.completion.bash @@ -0,0 +1,133 @@ +#!/usr/bin/env bash + +_composer() +{ + local cur script coms opts com + COMPREPLY=() + _get_comp_words_by_ref -n : cur words + + # for an alias, get the real script behind it + if [[ $(type -t ${words[0]}) == "alias" ]]; then + script=$(alias ${words[0]} | sed -E "s/alias ${words[0]}='(.*)'/\1/") + else + script=${words[0]} + fi + + # lookup for command + for word in ${words[@]:1}; do + if [[ $word != -* ]]; then + com=$word + break + fi + done + + # completing for an option + if [[ ${cur} == --* ]] ; then + opts="--help --quiet --verbose --version --ansi --no-ansi --no-interaction --profile --no-plugins --working-dir" + + case "$com" in + about) + opts="${opts} " + ;; + archive) + opts="${opts} --format --dir --file" + ;; + browse) + opts="${opts} --homepage --show" + ;; + clear-cache) + opts="${opts} " + ;; + config) + opts="${opts} --global --editor --auth --unset --list --file --absolute" + ;; + create-project) + opts="${opts} --stability --prefer-source --prefer-dist --repository --repository-url --dev --no-dev --no-custom-installers --no-scripts --no-progress --no-secure-http --keep-vcs --no-install --ignore-platform-reqs" + ;; + depends) + opts="${opts} --recursive --tree" + ;; + diagnose) + opts="${opts} " + ;; + dump-autoload) + opts="${opts} --no-scripts --optimize --classmap-authoritative --apcu --no-dev" + ;; + exec) + opts="${opts} --list" + ;; + global) + opts="${opts} " + ;; + help) + opts="${opts} --xml --format --raw" + ;; + init) + opts="${opts} --name --description --author --type --homepage --require --require-dev --stability --license --repository" + ;; + install) + opts="${opts} --prefer-source --prefer-dist --dry-run --dev --no-dev --no-custom-installers --no-autoloader --no-scripts --no-progress --no-suggest --optimize-autoloader --classmap-authoritative --apcu-autoloader --ignore-platform-reqs" + ;; + licenses) + opts="${opts} --format --no-dev" + ;; + list) + opts="${opts} --xml --raw --format" + ;; + outdated) + opts="${opts} --outdated --all --direct --strict" + ;; + prohibits) + opts="${opts} --recursive --tree" + ;; + remove) + opts="${opts} --dev --no-progress --no-update --no-scripts --update-no-dev --update-with-dependencies --no-update-with-dependencies --ignore-platform-reqs --optimize-autoloader --classmap-authoritative --apcu-autoloader" + ;; + require) + opts="${opts} --dev --prefer-source --prefer-dist --no-progress --no-suggest --no-update --no-scripts --update-no-dev --update-with-dependencies --ignore-platform-reqs --prefer-stable --prefer-lowest --sort-packages --optimize-autoloader --classmap-authoritative --apcu-autoloader" + ;; + run-script) + opts="${opts} --timeout --dev --no-dev --list" + ;; + search) + opts="${opts} --only-name --type" + ;; + self-update) + opts="${opts} --rollback --clean-backups --no-progress --update-keys --stable --preview --snapshot" + ;; + show) + opts="${opts} --all --installed --platform --available --self --name-only --path --tree --latest --outdated --minor-only --direct --strict" + ;; + status) + opts="${opts} " + ;; + suggests) + opts="${opts} --by-package --by-suggestion --no-dev" + ;; + update) + opts="${opts} --prefer-source --prefer-dist --dry-run --dev --no-dev --lock --no-custom-installers --no-autoloader --no-scripts --no-progress --no-suggest --with-dependencies --optimize-autoloader --classmap-authoritative --apcu-autoloader --ignore-platform-reqs --prefer-stable --prefer-lowest --interactive --root-reqs" + ;; + validate) + opts="${opts} --no-check-all --no-check-lock --no-check-publish --with-dependencies --strict" + ;; + + esac + + COMPREPLY=($(compgen -W "${opts}" -- ${cur})) + __ltrim_colon_completions "$cur" + + return 0; + fi + + # completing for a command + if [[ $cur == $com ]]; then + coms="about archive browse clear-cache config create-project depends diagnose dump-autoload exec global help init install licenses list outdated prohibits remove require run-script search self-update show status suggests update validate" + + COMPREPLY=($(compgen -W "${coms}" -- ${cur})) + __ltrim_colon_completions "$cur" + + return 0 + fi +} + +complete -o default -F _composer composer From a068e3b66e6a7cc536510ed9e6f9d8b5f15c1e74 Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Sat, 31 Dec 2016 12:10:57 -0800 Subject: [PATCH 07/53] Add option for basic git status prompt Fixes #873 --- themes/base.theme.bash | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index ed53fb16..a7e73bca 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -98,6 +98,44 @@ function scm_prompt_info { [[ $SCM == $SCM_SVN ]] && svn_prompt_info && return } +function scm_prompt_status { + scm + scm_prompt_char + SCM_DIRTY=0 + SCM_STATE='' + [[ $SCM == $SCM_GIT ]] && git_prompt_status && return + [[ $SCM == $SCM_HG ]] && hg_prompt_info && return + [[ $SCM == $SCM_SVN ]] && svn_prompt_info && return +} + +function git_prompt_status { + local ref + local status + local git_status_flags=('--porcelain') + SCM_STATE=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + + if [[ "$(command git config --get bash-it.hide-status)" != "1" ]]; then + # Get the branch reference + ref=$(command git symbolic-ref -q HEAD 2> /dev/null) || \ + ref=$(command git rev-parse --short HEAD 2> /dev/null) + SCM_BRANCH=${SCM_THEME_BRANCH_PREFIX}${ref#refs/heads/} + + # Get the status + [[ "${SCM_GIT_IGNORE_UNTRACKED}" = "true" ]] && git_status_flags+='-untracked-files=no' + status=$(command git status ${git_status_flags} 2> /dev/null | tail -n1) + + if [[ -n ${status} ]]; then + SCM_DIRTY=1 + SCM_STATE=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + fi + + # Output the git prompt + SCM_PREFIX=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} + SCM_SUFFIX=${GIT_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} + echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}" + fi +} + function git_status_summary { awk ' BEGIN { From 49e4b0958d582045884bb4d47c08705485c81c86 Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Sun, 1 Jan 2017 23:57:59 -0800 Subject: [PATCH 08/53] New plugin to enable vi editing mode --- plugins/available/edit-mode-vi.plugin.bash | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 plugins/available/edit-mode-vi.plugin.bash diff --git a/plugins/available/edit-mode-vi.plugin.bash b/plugins/available/edit-mode-vi.plugin.bash new file mode 100644 index 00000000..7684008b --- /dev/null +++ b/plugins/available/edit-mode-vi.plugin.bash @@ -0,0 +1,4 @@ +cite about-plugin +about-plugin 'Enable vi editing mode' + +set -o vi From 41eb07cde32da858bd0203287ee1b88d0392a9bb Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Mon, 2 Jan 2017 00:02:26 -0800 Subject: [PATCH 09/53] New plugin to enable emacs editing mode --- plugins/available/edit-mode-emacs.plugin.bash | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 plugins/available/edit-mode-emacs.plugin.bash diff --git a/plugins/available/edit-mode-emacs.plugin.bash b/plugins/available/edit-mode-emacs.plugin.bash new file mode 100644 index 00000000..19fc7f34 --- /dev/null +++ b/plugins/available/edit-mode-emacs.plugin.bash @@ -0,0 +1,4 @@ +cite about-plugin +about-plugin 'Enable emacs editing mode' + +set -o emacs From 0a84ca584e17c5b912bbb1ece00719ccbe13f4af Mon Sep 17 00:00:00 2001 From: Ilan Erenstein Date: Mon, 2 Jan 2017 14:41:35 -0800 Subject: [PATCH 10/53] Adding new updates for vault completions --- completion/available/vault.completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/completion/available/vault.completion.bash b/completion/available/vault.completion.bash index 838a0580..f0c747c1 100644 --- a/completion/available/vault.completion.bash +++ b/completion/available/vault.completion.bash @@ -16,7 +16,7 @@ function _vault_mounts() { } function _vault() { - local VAULT_COMMANDS='delete path-help read renew revoke server status write audit-disable audit-enable audit-list auth auth-disable auth-enable capabilities generate-root init key-status list mount mount-tune mounts policies policy-delete policy-write rekey remount rotate seal ssh step-down token-create token-lookup token-renew token-revoke unmount unseal version' + local VAULT_COMMANDS=$(vault 2>&1 | egrep '^ +' | awk '{print $1}') local cur local prev From 1d55249181df5e7123fcdd59f4a27bac1c75be7a Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Wed, 4 Jan 2017 15:48:32 -0800 Subject: [PATCH 11/53] Refactor functions and update documentation Add new variable to enable/disable git prompt minimal status information and consolidate functions for code re-use. Also update README documentation to capture the usage of new variable. --- README.md | 14 ++++++++++++++ themes/base.theme.bash | 33 ++++++++++++++++++--------------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index cb9e6eeb..1175bc30 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,8 @@ Set `SCM_GIT_SHOW_DETAILS` to 'false' to **don't show** it: * `export SCM_GIT_SHOW_DETAILS=false` +**NOTE:** If using `SCM_GIT_SHOW_MINIMAL_INFO=true`, then the value of `SCM_GIT_SHOW_DETAILS` is ignored. + #### Remotes and remote branches In some git workflows you must work with various remotes, for this reason, Bash-it can provide some useful information about your remotes and your remote branches, for example, the remote on you are working, or if your local branch is tracking a remote branch. @@ -218,6 +220,8 @@ Set `SCM_GIT_SHOW_REMOTE_INFO` to 'false' to **disable the feature**: * `export SCM_GIT_SHOW_REMOTE_INFO=false` +**NOTE:** If using `SCM_GIT_SHOW_MINIMAL_INFO=true`, then the value of `SCM_GIT_SHOW_REMOTE_INFO` is ignored. + #### Untracked files By default, `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, can be useful to instruct Bash-it to ignore these files. You can control this behavior with the flag `SCM_GIT_IGNORE_UNTRACKED`: @@ -250,6 +254,16 @@ And * `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. + +#### Git show minimal status info + +To speed up the prompt while still getting minimal git status information displayed such as the value of HEAD and whether there are any dirty objects, you can set: + +``` +export SCM_GIT_SHOW_MINIMAL_INFO=true +``` + #### Ignore repo status When working in repos with a large code base Bash-it can slow down your prompt when checking the repo status, to avoid it, there is an option you can set via Git config to disable checking repo status in Bash-it. diff --git a/themes/base.theme.bash b/themes/base.theme.bash index a7e73bca..d1e778e2 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -27,6 +27,7 @@ SCM_GIT_SHOW_DETAILS=${SCM_GIT_SHOW_DETAILS:=true} 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='git' SCM_GIT_CHAR='±' @@ -93,22 +94,24 @@ function scm_prompt_info { scm_prompt_char SCM_DIRTY=0 SCM_STATE='' - [[ $SCM == $SCM_GIT ]] && git_prompt_info && return - [[ $SCM == $SCM_HG ]] && hg_prompt_info && return - [[ $SCM == $SCM_SVN ]] && svn_prompt_info && return + + if [[ ${SCM} == ${SCM_GIT} ]]; then + if [[ ${SCM_GIT_SHOW_MINIMAL_INFO} == true ]]; then + # user requests minimal git status information + git_prompt_minimal_info + else + # more detailed git status + git_prompt_info + fi + return + fi + + # TODO: consider adding minimal status information for hg and svn + [[ ${SCM} == ${SCM_HG} ]] && hg_prompt_info && return + [[ ${SCM} == ${SCM_SVN} ]] && svn_prompt_info && return } -function scm_prompt_status { - scm - scm_prompt_char - SCM_DIRTY=0 - SCM_STATE='' - [[ $SCM == $SCM_GIT ]] && git_prompt_status && return - [[ $SCM == $SCM_HG ]] && hg_prompt_info && return - [[ $SCM == $SCM_SVN ]] && svn_prompt_info && return -} - -function git_prompt_status { +function git_prompt_minimal_info { local ref local status local git_status_flags=('--porcelain') @@ -117,7 +120,7 @@ function git_prompt_status { if [[ "$(command git config --get bash-it.hide-status)" != "1" ]]; then # Get the branch reference ref=$(command git symbolic-ref -q HEAD 2> /dev/null) || \ - ref=$(command git rev-parse --short HEAD 2> /dev/null) + ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 SCM_BRANCH=${SCM_THEME_BRANCH_PREFIX}${ref#refs/heads/} # Get the status From a70b7698177993137d576b85808f5017c48b8347 Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Wed, 4 Jan 2017 17:43:56 -0800 Subject: [PATCH 12/53] Remove references to GIT_THEME_* variables --- themes/base.theme.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index d1e778e2..42aaac58 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -115,7 +115,7 @@ function git_prompt_minimal_info { local ref local status local git_status_flags=('--porcelain') - SCM_STATE=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN} + SCM_STATE=${SCM_THEME_PROMPT_CLEAN} if [[ "$(command git config --get bash-it.hide-status)" != "1" ]]; then # Get the branch reference @@ -129,12 +129,12 @@ function git_prompt_minimal_info { if [[ -n ${status} ]]; then SCM_DIRTY=1 - SCM_STATE=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} + SCM_STATE=${SCM_THEME_PROMPT_DIRTY} fi # Output the git prompt - SCM_PREFIX=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} - SCM_SUFFIX=${GIT_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} + SCM_PREFIX=${SCM_THEME_PROMPT_PREFIX} + SCM_SUFFIX=${SCM_THEME_PROMPT_SUFFIX} echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}" fi } From 94ec03a8e5cd5200eb1a5145e4d2c6d3b2134a99 Mon Sep 17 00:00:00 2001 From: Maik Ellerbrock Date: Sun, 8 Jan 2017 23:31:55 +0100 Subject: [PATCH 13/53] add bash-it-docker to readme ![container](http://i.giphy.com/VNC7FTY49C0zC.gif) --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 1175bc30..5958e5a0 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,17 @@ fi Refer to the official [Bash documention](https://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files) to get more info. + +## Install Docker (NEW) + +You can try Bash-it in an isolated enviroment without changing any local files via Docker Container. +(Bash Shell v.4.4 with bash-it, bats and bash-completion based on Alpine Linux). + +`docker pull ellerbrock/bash-it` + +Have a look in our [bash-it-docker](https://github.com/Bash-it/bash-it-docker) Repository for further informations. + + ## Update To update Bash-it, simply run: From 4790569671dd8acd8a383c58c6839b043771a0e5 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Mon, 9 Jan 2017 09:03:30 +0100 Subject: [PATCH 14/53] Fixed percol plugin function syntax Without the `function` keyword, the file did not load when using Bash v3.x. With the added `function` keyword, the file can be parsed and the error message about having to install Bash v4 is shown. Closes #881 --- plugins/available/percol.plugin.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/available/percol.plugin.bash b/plugins/available/percol.plugin.bash index 067c6c8f..c58bfcff 100644 --- a/plugins/available/percol.plugin.bash +++ b/plugins/available/percol.plugin.bash @@ -29,13 +29,14 @@ _replace_by_history() { if command -v percol>/dev/null; then local current_version=${BASH_VERSION%%[^0-9]*} if [ $current_version -lt 4 ]; then - echo "Warning:You have to upgrade bash to bash 4.x to use percol plugin." + echo -e "\033[91mWarning: You have to upgrade Bash to Bash v4.x to use the 'percol' plugin.\033[m" + echo -e "\033[91m Your current Bash version is $BASH_VERSION.\033[m" else bind -x '"\C-r": _replace_by_history' # bind zz to percol if fasd enable if command -v fasd>/dev/null; then - zz(){ + function zz() { local l=$(fasd -d | awk '{print $2}' | percol) cd $l } From ce615b5239e6855dc5fbfd3ca120049fb97ea714 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Mon, 9 Jan 2017 09:22:33 +0100 Subject: [PATCH 15/53] Update README.md Updated some of the wording. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5958e5a0..b2ad2d88 100644 --- a/README.md +++ b/README.md @@ -37,14 +37,14 @@ fi Refer to the official [Bash documention](https://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files) to get more info. -## Install Docker (NEW) +## Install using Docker -You can try Bash-it in an isolated enviroment without changing any local files via Docker Container. -(Bash Shell v.4.4 with bash-it, bats and bash-completion based on Alpine Linux). +You can try Bash-it in an isolated enviroment 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` -Have a look in our [bash-it-docker](https://github.com/Bash-it/bash-it-docker) Repository for further informations. +Have a look at our [bash-it-docker respository](https://github.com/Bash-it/bash-it-docker) for further information. ## Update From 99bf5f09ad715f7c420724827ea68e8e1406ae09 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Mon, 9 Jan 2017 17:51:12 +0100 Subject: [PATCH 16/53] Moved grep alias to general aliases --- aliases/available/general.aliases.bash | 4 ++++ lib/appearance.bash | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aliases/available/general.aliases.bash b/aliases/available/general.aliases.bash index 99939386..611d8a12 100644 --- a/aliases/available/general.aliases.bash +++ b/aliases/available/general.aliases.bash @@ -11,6 +11,10 @@ alias l1='ls -1' alias _="sudo" +# colored grep +alias grep='grep --color=auto' +export GREP_COLOR='1;33' + if [ $(uname) = "Linux" ] then alias ls="ls --color=auto" diff --git a/lib/appearance.bash b/lib/appearance.bash index 4270f7e4..48134c98 100644 --- a/lib/appearance.bash +++ b/lib/appearance.bash @@ -1,9 +1,5 @@ #!/usr/bin/env bash -# colored grep -alias grep='grep --color=auto' -export GREP_COLOR='1;33' - # colored ls export LSCOLORS='Gxfxcxdxdxegedabagacad' From c64dd0a44d515881f8e34b232cc9d32dccbd4156 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Mon, 9 Jan 2017 17:54:35 +0100 Subject: [PATCH 17/53] Fixing `ls` alias definition Closes #819 and closes #643 --- aliases/available/general.aliases.bash | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/aliases/available/general.aliases.bash b/aliases/available/general.aliases.bash index 611d8a12..31e8557f 100644 --- a/aliases/available/general.aliases.bash +++ b/aliases/available/general.aliases.bash @@ -1,9 +1,15 @@ cite about-alias about-alias 'general aliases' +if ls --color -d . &> /dev/null +then + alias ls="ls --color=auto" +else + alias ls='ls -G' # Compact view, show colors +fi + # List directory contents alias sl=ls -alias ls='ls -G' # Compact view, show colors alias la='ls -AF' # Compact view, show hidden alias ll='ls -al' alias l='ls -a' @@ -15,10 +21,6 @@ alias _="sudo" alias grep='grep --color=auto' export GREP_COLOR='1;33' -if [ $(uname) = "Linux" ] -then - alias ls="ls --color=auto" -fi which gshuf &> /dev/null if [ $? -eq 0 ] then From 707f2aac9342532cbc908bf31cf5992204cacd55 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Mon, 9 Jan 2017 18:10:15 +0100 Subject: [PATCH 18/53] Added check for grep color option Closes #643 and closes #884 --- aliases/available/general.aliases.bash | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/aliases/available/general.aliases.bash b/aliases/available/general.aliases.bash index 31e8557f..38a8bfe6 100644 --- a/aliases/available/general.aliases.bash +++ b/aliases/available/general.aliases.bash @@ -4,7 +4,8 @@ about-alias 'general aliases' if ls --color -d . &> /dev/null then alias ls="ls --color=auto" -else +elif ls -G -d . &> /dev/null +then alias ls='ls -G' # Compact view, show colors fi @@ -18,8 +19,13 @@ alias l1='ls -1' alias _="sudo" # colored grep -alias grep='grep --color=auto' -export GREP_COLOR='1;33' +# Need to check an existing file for a pattern that will be found to ensure +# that the check works when on an OS that supports the color option +if grep --color=auto "a" $BASH_IT/*.md &> /dev/null +then + alias grep='grep --color=auto' + export GREP_COLOR='1;33' +fi which gshuf &> /dev/null if [ $? -eq 0 ] From ec5c317d1538137f83614224c4e6e5fa060545fe Mon Sep 17 00:00:00 2001 From: Ilan Erenstein Date: Thu, 12 Jan 2017 15:45:44 -0800 Subject: [PATCH 19/53] Remove bcup alias --- 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 f4c4836b..090622b0 100644 --- a/aliases/available/homebrew-cask.aliases.bash +++ b/aliases/available/homebrew-cask.aliases.bash @@ -3,7 +3,6 @@ cite 'about-alias' about-alias 'homebrew-cask abbreviations' -alias bcup='brew cask update' alias bcin='brew cask install' alias bcrm='brew cask uninstall' alias bczp='brew cask zap' From f9b1dcee261b9ef58370e203d76b517ff64b0a09 Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Mon, 9 Jan 2017 20:44:01 -0800 Subject: [PATCH 20/53] Add AIO function to echo scm prompt char and info Invoking the scm_char and scm_prompt_info functions separately for PS1 duplicates calls to the scm and scm_prompt_char functions to check what ${SCM}, if any, we currently reside in. This problem was exacerbated when working outside of any repo as we had to go through all the conditionals just to determine we're not in any scm repo. Unnecessary conditionals slows down the prompt so this adds a new function that streamlines printing out both the scm char and scm prompt info with one invocation. --- themes/base.theme.bash | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 42aaac58..1b64265c 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -111,6 +111,30 @@ function scm_prompt_info { [[ ${SCM} == ${SCM_SVN} ]] && svn_prompt_info && return } +function scm_prompt_char_info { + # Determine the scm char and print it + scm_prompt_char + echo -ne "${SCM_CHAR}" + + SCM_DIRTY=0 + SCM_STATE='' + + if [[ ${SCM} == ${SCM_GIT} ]]; then + if [[ ${SCM_GIT_SHOW_MINIMAL_INFO} == true ]]; then + # user requests minimal git status information + git_prompt_minimal_info + else + # more detailed git status + git_prompt_info + fi + return + fi + + # TODO: consider adding minimal status information for hg and svn + [[ ${SCM} == ${SCM_HG} ]] && hg_prompt_info && return + [[ ${SCM} == ${SCM_SVN} ]] && svn_prompt_info && return +} + function git_prompt_minimal_info { local ref local status From 9e4f1d6d800b8be92e5c33ebf022972d3c29890f Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Mon, 9 Jan 2017 21:17:00 -0800 Subject: [PATCH 21/53] Refactor common code into scm_prompt_info_common --- themes/base.theme.bash | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 1b64265c..7ee3330c 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -92,30 +92,16 @@ function scm_prompt_vars { function scm_prompt_info { scm scm_prompt_char - SCM_DIRTY=0 - SCM_STATE='' - - if [[ ${SCM} == ${SCM_GIT} ]]; then - if [[ ${SCM_GIT_SHOW_MINIMAL_INFO} == true ]]; then - # user requests minimal git status information - git_prompt_minimal_info - else - # more detailed git status - git_prompt_info - fi - return - fi - - # 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_prompt_info_common } function scm_prompt_char_info { - # Determine the scm char and print it scm_prompt_char echo -ne "${SCM_CHAR}" + scm_prompt_info_common +} +function scm_prompt_info_common { SCM_DIRTY=0 SCM_STATE='' From 48d4ad274a03f64c9b034b0b09f9be02cf5b6ebf Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Mon, 16 Jan 2017 23:20:31 -0800 Subject: [PATCH 22/53] Add prefix and suffix capability to SCM char --- themes/base.theme.bash | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 7ee3330c..fc1ee287 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -20,6 +20,8 @@ SCM_THEME_BRANCH_TRACK_PREFIX=' → ' SCM_THEME_BRANCH_GONE_PREFIX=' ⇢ ' SCM_THEME_CURRENT_USER_PREFFIX=' ☺︎ ' SCM_THEME_CURRENT_USER_SUFFIX='' +SCM_THEME_CHAR_PREFIX='' +SCM_THEME_CHAR_SUFFIX='' THEME_BATTERY_PERCENTAGE_CHECK=${THEME_BATTERY_PERCENTAGE_CHECK:=true} @@ -97,7 +99,7 @@ function scm_prompt_info { function scm_prompt_char_info { scm_prompt_char - echo -ne "${SCM_CHAR}" + echo -ne "${SCM_THEME_CHAR_PREFIX}${SCM_CHAR}${SCM_THEME_CHAR_SUFFIX}" scm_prompt_info_common } @@ -439,7 +441,7 @@ function hg_prompt_info() { function scm_char { scm_prompt_char - echo -e "$SCM_CHAR" + echo -e "${SCM_THEME_CHAR_PREFIX}${SCM_CHAR}${SCM_THEME_CHAR_SUFFIX}" } function prompt_char { From 17999fcc13fbf0baaecc52e9c054308acac55805 Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Mon, 16 Jan 2017 23:23:13 -0800 Subject: [PATCH 23/53] Update bobby theme to use scm_prompt_char_info The bobby theme now uses scm_prompt_char_info to print out the SCM char and SCM prompt info. This also required fixing the SCM_THEME_PROMPT_PREFIX to match GIT_THEME_PROMPT_PREFIX. --- themes/bobby/bobby.theme.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/bobby/bobby.theme.bash b/themes/bobby/bobby.theme.bash index 1c78025c..0e70f8a6 100644 --- a/themes/bobby/bobby.theme.bash +++ b/themes/bobby/bobby.theme.bash @@ -2,7 +2,7 @@ SCM_THEME_PROMPT_DIRTY=" ${red}✗" SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" -SCM_THEME_PROMPT_PREFIX=" |" +SCM_THEME_PROMPT_PREFIX=" ${green}|" SCM_THEME_PROMPT_SUFFIX="${green}|" GIT_THEME_PROMPT_DIRTY=" ${red}✗" @@ -23,7 +23,7 @@ __bobby_clock() { function prompt_command() { #PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(ruby_version_prompt) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} " - PS1="\n$(battery_char) $(__bobby_clock)${yellow}$(ruby_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " + PS1="\n$(battery_char) $(__bobby_clock)${yellow}$(ruby_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_prompt_char_info) ${green}→${reset_color} " } THEME_SHOW_CLOCK_CHAR=${THEME_SHOW_CLOCK_CHAR:-"true"} From 1f0108193d8395424c83a1a80b770356399ad00a Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Tue, 17 Jan 2017 00:01:49 -0800 Subject: [PATCH 24/53] Fix for issue #883 --- themes/base.theme.bash | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 42aaac58..753d075d 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -464,11 +464,13 @@ function aws_profile { } function safe_append_prompt_command { - if [[ -n $1 ]] ; then - case $PROMPT_COMMAND in - *$1*) ;; - "") PROMPT_COMMAND="$1";; - *) PROMPT_COMMAND="$1;$PROMPT_COMMAND";; - esac + local prompt_re="\<${1}\>" # exact match regex + + if [[ ${PROMPT_COMMAND} =~ ${prompt_re} ]]; then + return + elif [[ -z ${PROMPT_COMMAND} ]]; then + PROMPT_COMMAND="${1}" + else + PROMPT_COMMAND="${1};${PROMPT_COMMAND}" fi } From 31e3d78ae4bd12678e5cab8b77b41a9be5971c1c Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Sun, 29 Jan 2017 22:38:58 -0800 Subject: [PATCH 25/53] Fix exact match regular expression for macOS --- themes/base.theme.bash | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 753d075d..6d32dc14 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -464,7 +464,16 @@ function aws_profile { } function safe_append_prompt_command { - local prompt_re="\<${1}\>" # exact match regex + local prompt_re + + # Set OS dependent exact match regular expression + if [[ ${OSTYPE} == darwin* ]]; then + # macOS + prompt_re="[[:<:]]${1}[[:>:]]" + else + # Linux, FreeBSD, etc. + prompt_re="\<${1}\>" + fi if [[ ${PROMPT_COMMAND} =~ ${prompt_re} ]]; then return From 88802c141b934194a9eaae0378bdd91bcfc13998 Mon Sep 17 00:00:00 2001 From: ari mourao Date: Fri, 3 Feb 2017 15:12:49 -0200 Subject: [PATCH 26/53] new theme 90210 added --- themes/90210/90210.theme.bash | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 themes/90210/90210.theme.bash diff --git a/themes/90210/90210.theme.bash b/themes/90210/90210.theme.bash new file mode 100644 index 00000000..e683e0ef --- /dev/null +++ b/themes/90210/90210.theme.bash @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +SCM_THEME_PROMPT_DIRTY=" ${red}✗" +SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" +SCM_THEME_PROMPT_PREFIX=" |" +SCM_THEME_PROMPT_SUFFIX="${green}|" + +GIT_THEME_PROMPT_DIRTY=" ${red}✗" +GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" +GIT_THEME_PROMPT_PREFIX=" ${green}|" +GIT_THEME_PROMPT_SUFFIX="${green}|" + +# Nicely formatted terminal prompt +function prompt_command(){ + export PS1="\n${bold_black}[${blue}\@${bold_black}]-${bold_black}[${green}\u${yellow}@${green}\h${bold_black}]-${bold_black}[${purple}\w${bold_black}]-$(scm_prompt_info)\n${reset_color}\$ " +} + +safe_append_prompt_command prompt_command From 6a0eb8cf03898e57d51f1e018020c61d31f29aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Fr=C3=B6mer?= Date: Mon, 6 Feb 2017 11:49:18 +0100 Subject: [PATCH 27/53] Add 'git rm' alias 'grm' --- 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 28b93b12..eb3554be 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -4,6 +4,7 @@ about-alias 'common git abbreviations' # Aliases alias gcl='git clone' alias ga='git add' +alias grm='git rm' alias gap='git add -p' alias gall='git add -A' alias gf='git fetch --all --prune' From c7c488f0b08f69a58b136da82fbeb4c0f7e3d994 Mon Sep 17 00:00:00 2001 From: Ari Mourao Date: Thu, 9 Feb 2017 14:45:25 -0200 Subject: [PATCH 28/53] enable powerscript to check if user can sudo his workstation --- themes/powerline/README.md | 3 +++ themes/powerline/powerline.base.bash | 6 ++++-- themes/powerline/powerline.theme.bash | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/themes/powerline/README.md b/themes/powerline/README.md index 9ee38271..0f871cdb 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -4,6 +4,9 @@ A colorful theme, where shows a lot information about your shell session. **IMPORTANT:** This theme requires that [a font with the Powerline symbols](https://github.com/powerline/fonts) needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. +**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If it's not the case (i.e you are running on +a corporate network) you can set the flag 'CAN_SUDO=false' in powerbase.theme.bash + ## Provided Information * Current path diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index 3abeda8d..108304e9 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -13,8 +13,10 @@ function __powerline_user_info_prompt { local user_info="" local color=${USER_INFO_THEME_PROMPT_COLOR} - if sudo -n uptime 2>&1 | grep -q "load"; then - color=${USER_INFO_THEME_PROMPT_COLOR_SUDO} + if ${CAN_SUDO}; then + if sudo -n uptime 2>&1 | grep -q "load"; then + color=${USER_INFO_THEME_PROMPT_COLOR_SUDO} + fi fi case "${POWERLINE_PROMPT_USER_INFO_MODE}" in "sudo") diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index 12de9cbe..c71b9c1a 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -2,6 +2,8 @@ . "$BASH_IT/themes/powerline/powerline.base.bash" +CAN_SUDO=true + PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""} POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} From 7415c85ed818321a7564c566d58dbc11e68af9b9 Mon Sep 17 00:00:00 2001 From: Ari Mourao Date: Thu, 9 Feb 2017 15:22:49 -0200 Subject: [PATCH 29/53] corrected typo --- themes/powerline/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/powerline/README.md b/themes/powerline/README.md index 0f871cdb..c92ecd36 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -5,7 +5,7 @@ A colorful theme, where shows a lot information about your shell session. **IMPORTANT:** This theme requires that [a font with the Powerline symbols](https://github.com/powerline/fonts) needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. **NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If it's not the case (i.e you are running on -a corporate network) you can set the flag 'CAN_SUDO=false' in powerbase.theme.bash +a corporate network) you can set the flag 'CAN_SUDO=false' in powerline.theme.bash ## Provided Information From fd8b98fb2462a972e1f006982a9e769b0a3d0241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Aguiar=20Mart=C3=ADn?= Date: Thu, 9 Feb 2017 23:57:01 +0000 Subject: [PATCH 30/53] Update npm.aliases.bash ### Changed the 'npm uninstall --save-dev' alias because it was the same as 'npm update' * alias nud='npm uninstall --save-dev' --> alias nusd='npm uninstall --save-dev' --- aliases/available/npm.aliases.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aliases/available/npm.aliases.bash b/aliases/available/npm.aliases.bash index b01241e7..4623c738 100644 --- a/aliases/available/npm.aliases.bash +++ b/aliases/available/npm.aliases.bash @@ -10,7 +10,7 @@ alias nits='npm install-test --save' alias nitd='npm install-test --save-dev' alias nu='npm uninstall' alias nus='npm uninstall --save' -alias nud='npm uninstall --save-dev' +alias nusd='npm uninstall --save-dev' alias np='npm publish' alias nup='npm unpublish' alias nlk='npm link' From 4eeb98772b687ff51b5838f1eb2f601d0d985010 Mon Sep 17 00:00:00 2001 From: Ari Mourao Date: Fri, 10 Feb 2017 16:43:22 -0200 Subject: [PATCH 31/53] added suggested improvements --- themes/powerline/README.md | 2 +- themes/powerline/powerline.base.bash | 2 +- themes/powerline/powerline.theme.bash | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/powerline/README.md b/themes/powerline/README.md index c92ecd36..96108f1f 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -5,7 +5,7 @@ A colorful theme, where shows a lot information about your shell session. **IMPORTANT:** This theme requires that [a font with the Powerline symbols](https://github.com/powerline/fonts) needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. **NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If it's not the case (i.e you are running on -a corporate network) you can set the flag 'CAN_SUDO=false' in powerline.theme.bash +a corporate network) you can set the flag 'THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=false}' in powerline.theme.bash ## Provided Information diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index 108304e9..a911d12b 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -13,7 +13,7 @@ function __powerline_user_info_prompt { local user_info="" local color=${USER_INFO_THEME_PROMPT_COLOR} - if ${CAN_SUDO}; then + if [[ "THEME_CHECK_SUDO" = true ]]; then if sudo -n uptime 2>&1 | grep -q "load"; then color=${USER_INFO_THEME_PROMPT_COLOR_SUDO} fi diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index c71b9c1a..d2338fc7 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -2,7 +2,7 @@ . "$BASH_IT/themes/powerline/powerline.base.bash" -CAN_SUDO=true +THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true} PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""} POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} From d39dd88fd32c1e4e7d0054713d081a7527c87472 Mon Sep 17 00:00:00 2001 From: Frederick Stark Date: Sun, 12 Feb 2017 11:52:21 +1100 Subject: [PATCH 32/53] fix sublime text alias --- aliases/available/osx.aliases.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aliases/available/osx.aliases.bash b/aliases/available/osx.aliases.bash index 3d09605e..5e30bc7c 100644 --- a/aliases/available/osx.aliases.bash +++ b/aliases/available/osx.aliases.bash @@ -18,7 +18,7 @@ alias textedit='open -a TextEdit' alias hex='open -a "Hex Fiend"' alias skype='open -a Skype' alias mou='open -a Mou' -alias subl='open -a Sublime\ Text --args' +alias subl='open -a Sublime\ Text' if [ -s /usr/bin/firefox ] ; then unalias firefox From 7d9628d4f507952dabe88fd502292ca863ae5a70 Mon Sep 17 00:00:00 2001 From: Ari Mourao Date: Sun, 12 Feb 2017 14:03:45 -0200 Subject: [PATCH 33/53] refactoring to comply with standards --- themes/powerline/README.md | 2 +- themes/powerline/powerline.base.bash | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/powerline/README.md b/themes/powerline/README.md index 96108f1f..512461fb 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -5,7 +5,7 @@ A colorful theme, where shows a lot information about your shell session. **IMPORTANT:** This theme requires that [a font with the Powerline symbols](https://github.com/powerline/fonts) needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. **NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If it's not the case (i.e you are running on -a corporate network) you can set the flag 'THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=false}' in powerline.theme.bash +a corporate network) you can set the flag 'THEME_CHECK_SUDO=false' in your ~/.bashrc or ~/.bash_profile ## Provided Information diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index a911d12b..ff039c7a 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -13,7 +13,7 @@ function __powerline_user_info_prompt { local user_info="" local color=${USER_INFO_THEME_PROMPT_COLOR} - if [[ "THEME_CHECK_SUDO" = true ]]; then + if [[ "${THEME_CHECK_SUDO}" = true ]]; then if sudo -n uptime 2>&1 | grep -q "load"; then color=${USER_INFO_THEME_PROMPT_COLOR_SUDO} fi From ba25652662d2a74c1512193c81bdb02ec11c7de6 Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Sun, 12 Feb 2017 16:58:48 -0800 Subject: [PATCH 34/53] Added new font theme --- themes/font/font.theme.bash | 60 +++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 themes/font/font.theme.bash diff --git a/themes/font/font.theme.bash b/themes/font/font.theme.bash new file mode 100644 index 00000000..679528e7 --- /dev/null +++ b/themes/font/font.theme.bash @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +# +# One line prompt showing the following configurable information +# for git: +# time (virtual_env) username@hostname pwd git_char|git_branch git_dirty_status|→ +# +# The → arrow shows the exit status of the last command: +# - bold green: 0 exit status +# - bold red: non-zero exit status +# +# Example outside git repo: +# 07:45:05 user@host ~ → +# +# Example inside clean git repo: +# 07:45:05 user@host .bash_it ±|master|→ +# +# Example inside dirty git repo: +# 07:45:05 user@host .bash_it ±|master ✗|→ +# +# Example with virtual environment: +# 07:45:05 (venv) user@host ~ → +# + +SCM_NONE_CHAR='' +SCM_THEME_PROMPT_DIRTY=" ${red}✗" +SCM_THEME_PROMPT_CLEAN="" +SCM_THEME_PROMPT_PREFIX="${green}|" +SCM_THEME_PROMPT_SUFFIX="${green}|" +SCM_GIT_SHOW_MINIMAL_INFO=true + +CLOCK_THEME_PROMPT_PREFIX='' +CLOCK_THEME_PROMPT_SUFFIX=' ' +THEME_SHOW_CLOCK=true +THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$bold_blue"} +THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%I:%M:%S"} + +VIRTUALENV_THEME_PROMPT_PREFIX='(' +VIRTUALENV_THEME_PROMPT_SUFFIX=') ' + +function prompt_command() { + # This needs to be first to save last command return code + local RC="$?" + + hostname="${bold_black}\u@\h" + virtualenv="${white}$(virtualenv_prompt)" + + # Set return status color + if [[ ${RC} == 0 ]]; then + ret_status="${bold_green}" + else + ret_status="${bold_red}" + fi + + # Append new history lines to history file + history -a + + PS1="$(clock_prompt)${virtualenv}${hostname} ${bold_cyan}\W $(scm_prompt_char_info)${ret_status}→ ${normal}" +} + +safe_append_prompt_command prompt_command From db7ad196b7488994dab67e5ab8ff37759514fb42 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Tue, 14 Feb 2017 08:48:46 +0100 Subject: [PATCH 35/53] Made the change from #902 available to Powerline themes --- themes/powerline/README.md | 3 +-- themes/powerline/powerline.base.bash | 3 +++ themes/powerline/powerline.theme.bash | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/powerline/README.md b/themes/powerline/README.md index 512461fb..d0a46815 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -4,8 +4,7 @@ A colorful theme, where shows a lot information about your shell session. **IMPORTANT:** This theme requires that [a font with the Powerline symbols](https://github.com/powerline/fonts) needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator. -**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If it's not the case (i.e you are running on -a corporate network) you can set the flag 'THEME_CHECK_SUDO=false' in your ~/.bashrc or ~/.bash_profile +**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If that is not the case (e.g. if you are running on a corporate network where `sudo` usage is tracked), you can set the flag 'export THEME_CHECK_SUDO=false' in your `~/.bashrc` or `~/.bash_profile` to disable the Powerline theme's `sudo` check. This will apply to all `powerline*` themes. ## Provided Information diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index ff039c7a..dff870cb 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -1,3 +1,6 @@ +# Define this here so it can be used by all of the Powerline themes +THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true} + function set_color { if [[ "${1}" != "-" ]]; then fg="38;5;${1}" diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index d2338fc7..12de9cbe 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -2,8 +2,6 @@ . "$BASH_IT/themes/powerline/powerline.base.bash" -THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true} - PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""} POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} From d81c35d7527bdb4aca2beec7454bee5c89219496 Mon Sep 17 00:00:00 2001 From: Dylan Semler Date: Wed, 15 Feb 2017 06:31:10 -0500 Subject: [PATCH 36/53] Simplify docker functions Instead of piping the standard output of `docker ps` and `docker images` through a series of heads, tails, and awks, use the flags available to the `docker` command to achieve the same goal. --- plugins/available/docker.plugin.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/available/docker.plugin.bash b/plugins/available/docker.plugin.bash index 4a2abbd7..0a93c245 100644 --- a/plugins/available/docker.plugin.bash +++ b/plugins/available/docker.plugin.bash @@ -4,13 +4,13 @@ about-plugin 'Helpers to more easily work with Docker' function docker-remove-most-recent-container() { about 'attempt to remove the most recent container from docker ps -a' group 'docker' - docker ps -a | head -2 | tail -1 | awk '{print $NF}' | xargs docker rm + docker ps -ql | xargs docker rm } function docker-remove-most-recent-image() { about 'attempt to remove the most recent image from docker images' group 'docker' - docker images | head -2 | tail -1 | awk '{print $3}' | xargs docker rmi + docker images -q | head -1 | xargs docker rmi } function docker-enter() { From 20a49e6393d2885579fcf2f2b7fbeb886cecb05a Mon Sep 17 00:00:00 2001 From: Dylan Semler Date: Wed, 15 Feb 2017 07:00:42 -0500 Subject: [PATCH 37/53] Add plugin and alias for cleaning docker assets --- aliases/available/docker.aliases.bash | 1 + plugins/available/docker.plugin.bash | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/aliases/available/docker.aliases.bash b/aliases/available/docker.aliases.bash index bb9f99ca..7d837c70 100644 --- a/aliases/available/docker.aliases.bash +++ b/aliases/available/docker.aliases.bash @@ -10,6 +10,7 @@ alias dki='docker images' # List Docker images alias dkrmac='docker rm $(docker ps -a -q)' # Delete all Docker containers alias dkrmlc='docker-remove-most-recent-container' # Delete most recent (i.e., last) Docker container alias dkrmui='docker images -q -f dangling=true |xargs -r docker rmi' # Delete all untagged Docker images +alias dkrmall='docker-remove-stale-assets' # Delete all untagged images and exited containers alias dkrmli='docker-remove-most-recent-image' # Delete most recent (i.e., last) Docker image alias dkrmi='docker-remove-images' # Delete images for supplied IDs or all if no IDs are passed as arguments alias dkideps='docker-image-dependencies' # Output a graph of image dependencies using Graphiz diff --git a/plugins/available/docker.plugin.bash b/plugins/available/docker.plugin.bash index 4a2abbd7..7d0f58f5 100644 --- a/plugins/available/docker.plugin.bash +++ b/plugins/available/docker.plugin.bash @@ -13,6 +13,13 @@ function docker-remove-most-recent-image() { docker images | head -2 | tail -1 | awk '{print $3}' | xargs docker rmi } +function docker-remove-stale-assets() { + about 'attempt to remove exited containers and dangling images' + group 'docker' + docker ps --filter status=exited -q | xargs docker rm --volumes + docker images --filter dangling=true -q | xargs docker rmi +} + function docker-enter() { about 'enter the specified docker container using bash' group 'docker' From 7d11a9d935e26c1434ed1199adb0a146aad631ee Mon Sep 17 00:00:00 2001 From: LanikSJ Date: Mon, 6 Mar 2017 16:04:42 -0800 Subject: [PATCH 38/53] Adding pip3 completion --- completion/available/pip3.completion.bash | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 completion/available/pip3.completion.bash diff --git a/completion/available/pip3.completion.bash b/completion/available/pip3.completion.bash new file mode 100644 index 00000000..1800756b --- /dev/null +++ b/completion/available/pip3.completion.bash @@ -0,0 +1,11 @@ + +# pip bash completion start +_pip_completion() +{ + COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \ + COMP_CWORD=$COMP_CWORD \ + PIP_AUTO_COMPLETE=1 $1 ) ) +} +complete -o default -F _pip_completion pip3 +# pip bash completion end + From 007adac0fdbeeaad58d35a8c51a607b374fc7b4c Mon Sep 17 00:00:00 2001 From: LanikSJ Date: Fri, 10 Mar 2017 11:38:40 -0800 Subject: [PATCH 39/53] Adding more git aliases --- aliases/available/git.aliases.bash | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index eb3554be..ef6ca6d0 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -66,6 +66,11 @@ alias gnew="git log HEAD@{1}..HEAD@{0}" # Add uncommitted and unstaged changes to the last commit alias gcaa="git commit -a --amend -C HEAD" alias ggui="git gui" +alias gcam="git commit -am" +alias gcsam="git commit -S -am" +alias gmu="git fetch origin -v && git merge origin/master" +alias gstd="git stash drop" +alias gstl="git stash list" case $OSTYPE in darwin*) From 3679bc2e5bb0cea66979b5848180876bd3e42529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Fr=C3=B6mer?= Date: Mon, 13 Mar 2017 13:36:53 +0100 Subject: [PATCH 40/53] Add alias gmv This will enable the ability to rename a branch using bash-it git alias --- 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..2919da03 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -41,6 +41,7 @@ alias gci='git commit --interactive' alias gb='git branch' alias gba='git branch -a' alias gbt='git branch --track' +alias gmv='git branch -m' alias gcount='git shortlog -sn' alias gcp='git cherry-pick' alias gco='git checkout' From fb95a1341057d08379782aa7735b12da888d8fcb Mon Sep 17 00:00:00 2001 From: LanikSJ Date: Mon, 13 Mar 2017 09:24:32 -0700 Subject: [PATCH 41/53] Removing conflicting alias --- 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 ef6ca6d0..9df7c992 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -68,7 +68,6 @@ alias gcaa="git commit -a --amend -C HEAD" alias ggui="git gui" alias gcam="git commit -am" alias gcsam="git commit -S -am" -alias gmu="git fetch origin -v && git merge origin/master" alias gstd="git stash drop" alias gstl="git stash list" From 43a63965ee394c1609f57e7cbd6bd5365ae3b9fb Mon Sep 17 00:00:00 2001 From: con-f-use Date: Fri, 17 Mar 2017 20:29:02 +0100 Subject: [PATCH 42/53] Alias and complete common misspellings of bash-it --- aliases/available/general.aliases.bash | 7 +++++++ completion/available/bash-it.completion.bash | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/aliases/available/general.aliases.bash b/aliases/available/general.aliases.bash index 38a8bfe6..a4cf4ee2 100644 --- a/aliases/available/general.aliases.bash +++ b/aliases/available/general.aliases.bash @@ -71,6 +71,13 @@ fi alias md='mkdir -p' alias rd='rmdir' +# Common misspellings of bash-it +alias shit='bash-it' +alias batshit='bash-it' +alias bashit='bash-it' +alias bash_it='bash-it' +alias bash_ti='bash-it' + # Display whatever file is regular file or folder catt() { for i in "$@"; do diff --git a/completion/available/bash-it.completion.bash b/completion/available/bash-it.completion.bash index f4326a0a..edcad0ea 100644 --- a/completion/available/bash-it.completion.bash +++ b/completion/available/bash-it.completion.bash @@ -110,4 +110,10 @@ _bash-it-comp() return 0 } +# Activate completion for bash-it and its common misspellings complete -F _bash-it-comp bash-it +complete -F _bash-it-comp bash-ti +complete -F _bash-it-comp shit +complete -F _bash-it-comp bashit +complete -F _bash-it-comp batshit +complete -F _bash-it-comp bash_it From 2a29f6ba59a4069ec86a0b2c109e596e91c2e7f2 Mon Sep 17 00:00:00 2001 From: Jeremy Nicklas Date: Tue, 21 Mar 2017 06:53:09 -0400 Subject: [PATCH 43/53] simplify git diff alias Fixes https://github.com/Bash-it/bash-it/issues/921 --- aliases/available/git.aliases.bash | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index 7e7bc7eb..0c96f8a4 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -33,6 +33,7 @@ alias gpom='git push origin master' alias gr='git remote' alias grv='git remote -v' alias gra='git remote add' +alias gd='git diff' alias gdv='git diff -w "$@" | vim -R -' alias gc='git commit -v' alias gca='git commit -v -a' @@ -80,19 +81,3 @@ case $OSTYPE in alias gtls='git tag -l | sort -V' ;; esac - -if [ -z "$EDITOR" ]; then - case $OSTYPE in - linux*) - alias gd='git diff | vim -R -' - ;; - darwin*) - alias gd='git diff | mate' - ;; - *) - alias gd='git diff' - ;; - esac -else - alias gd="git diff | $EDITOR" -fi From 1258757fc7ae26d1aa305041cecdf0be3e04b088 Mon Sep 17 00:00:00 2001 From: Vladimir Rudnyh Date: Tue, 21 Mar 2017 15:01:29 +0300 Subject: [PATCH 44/53] Python errors handling in 'pyedit' command Do now show python warnings (import or syntax) if module name is bad. --- plugins/available/python.plugin.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/available/python.plugin.bash b/plugins/available/python.plugin.bash index ad7e4069..ceba6268 100644 --- a/plugins/available/python.plugin.bash +++ b/plugins/available/python.plugin.bash @@ -14,7 +14,7 @@ function pyedit() { example '$ pyedit requests' group 'python' - xpyc=`python -c "import sys; stdout = sys.stdout; sys.stdout = sys.stderr; import $1; stdout.write($1.__file__)"` + xpyc=`python -c "import os, sys; f = open(os.devnull, 'w'); sys.stderr = f; module = __import__('$1'); sys.stdout.write(module.__file__)"` if [ "$xpyc" == "" ]; then echo "Python module $1 not found" From 588213980d90bc07f5c2d5ba24ced834d3ce3327 Mon Sep 17 00:00:00 2001 From: Jeremy Mathevet Date: Tue, 21 Mar 2017 12:04:18 +0000 Subject: [PATCH 45/53] Prevent unbound variable errors --- themes/powerline/powerline.base.bash | 3 +++ 1 file changed, 3 insertions(+) diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index dff870cb..f65e9dd6 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -2,6 +2,7 @@ THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true} function set_color { + set +u if [[ "${1}" != "-" ]]; then fg="38;5;${1}" fi @@ -13,6 +14,7 @@ function set_color { } function __powerline_user_info_prompt { + set +u local user_info="" local color=${USER_INFO_THEME_PROMPT_COLOR} @@ -51,6 +53,7 @@ function __powerline_ruby_prompt { } function __powerline_python_venv_prompt { + set +u local python_venv="" if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then From 63b0269daf2631841ca809a31003042201a885ae Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Thu, 23 Mar 2017 08:09:52 +0100 Subject: [PATCH 46/53] Added .gitattributes file to enforce LF line endings --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..d4c710cb --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.sh text eol=lf +*.bash text eol=lf From 5cd496813edc3a9781e9e5a8b59ecac47879f081 Mon Sep 17 00:00:00 2001 From: LanikSJ Date: Thu, 23 Mar 2017 15:57:27 -0700 Subject: [PATCH 47/53] Adding RVM Completion --- completion/available/rvm.completion.bash | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 completion/available/rvm.completion.bash diff --git a/completion/available/rvm.completion.bash b/completion/available/rvm.completion.bash new file mode 100644 index 00000000..9a57b035 --- /dev/null +++ b/completion/available/rvm.completion.bash @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# Bash completion support for RVM. + + +_rvm_complete() { + [[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion +} + +complete -o default -o nospace -F _rvm_complete rvm From 4d0815329aaf801d27e5242a05cc2f1cfeae0507 Mon Sep 17 00:00:00 2001 From: LanikSJ Date: Thu, 23 Mar 2017 16:10:22 -0700 Subject: [PATCH 48/53] Adding source of RVM Completion --- completion/available/rvm.completion.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/completion/available/rvm.completion.bash b/completion/available/rvm.completion.bash index 9a57b035..dc27d190 100644 --- a/completion/available/rvm.completion.bash +++ b/completion/available/rvm.completion.bash @@ -1,5 +1,6 @@ #!/usr/bin/env bash # Bash completion support for RVM. +# Source: https://rvm.io/workflow/completion _rvm_complete() { From 3450e20857580296cff6f78bf190f78d13040253 Mon Sep 17 00:00:00 2001 From: Dayne Broderson Date: Fri, 24 Mar 2017 00:23:12 -0800 Subject: [PATCH 49/53] adding ability to set theme as a path to specific file --- lib/appearance.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/appearance.bash b/lib/appearance.bash index 48134c98..6d0ef2ff 100644 --- a/lib/appearance.bash +++ b/lib/appearance.bash @@ -9,7 +9,9 @@ fi # Load the theme if [[ $BASH_IT_THEME ]]; then - if [[ -f "$CUSTOM_THEME_DIR/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash" ]]; then + if [[ -f $BASH_IT_THEME ]]; then + source $BASH_IT_THEME + elif [[ -f "$CUSTOM_THEME_DIR/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash" ]]; then source "$CUSTOM_THEME_DIR/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash" else source "$BASH_IT/themes/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash" From c18d4338e604495b9e74a01e8a038fcabe6364d2 Mon Sep 17 00:00:00 2001 From: LanikSJ Date: Fri, 24 Mar 2017 01:36:24 -0700 Subject: [PATCH 50/53] Removing redundant lines --- completion/available/rvm.completion.bash | 2 -- 1 file changed, 2 deletions(-) diff --git a/completion/available/rvm.completion.bash b/completion/available/rvm.completion.bash index dc27d190..b9132a9b 100644 --- a/completion/available/rvm.completion.bash +++ b/completion/available/rvm.completion.bash @@ -6,5 +6,3 @@ _rvm_complete() { [[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion } - -complete -o default -o nospace -F _rvm_complete rvm From 8d329bd6105ef7fc86fa46564497e15179124535 Mon Sep 17 00:00:00 2001 From: LanikSJ Date: Fri, 24 Mar 2017 01:41:48 -0700 Subject: [PATCH 51/53] Remove the function as it's not needed now --- completion/available/rvm.completion.bash | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/completion/available/rvm.completion.bash b/completion/available/rvm.completion.bash index b9132a9b..cd8ded04 100644 --- a/completion/available/rvm.completion.bash +++ b/completion/available/rvm.completion.bash @@ -2,7 +2,4 @@ # Bash completion support for RVM. # Source: https://rvm.io/workflow/completion - -_rvm_complete() { - [[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion -} +[[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion From 28e2637fa0a572bb2388038a09e4a83057fdc006 Mon Sep 17 00:00:00 2001 From: Dayne Broderson Date: Sat, 25 Mar 2017 21:17:24 -0800 Subject: [PATCH 52/53] adding docs for the new feature --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b2ad2d88..2e7facd7 100644 --- a/README.md +++ b/README.md @@ -144,11 +144,12 @@ Alternately, if you would like to keep your custom scripts under version control ## Themes -There are a few Bash-it themes. If you've created your own custom prompts, I'd love it if you shared with everyone else! Just submit a Pull Request. +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 directly to the theme file. -You can see the theme screenshots [here](https://github.com/Bash-it/bash-it/wiki/Themes). +You can easily preview the themes in your own shell using `BASH_PREVIEW=true reload`. -Alternatively, you can preview the themes in your own shell using `BASH_PREVIEW=true reload`. +If you've created your own custom prompts, I'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). **NOTE**: Bash-it and some themes use UTF-8 characters, so to avoid extrange behaviors in your terminal, set your locale to `LC_ALL=en_US.UTF-8` or the equivalent to your language if isn't American English. From 255fadf3cc57232c316a87bf9604edfc6d6d27ae Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Mon, 27 Mar 2017 08:25:17 +0200 Subject: [PATCH 53/53] More documentation for Theme location See #930 for the original PR. --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2e7facd7..6219d636 100644 --- a/README.md +++ b/README.md @@ -140,18 +140,28 @@ For custom scripts, and aliases, just create the following files (they'll be ign Anything in the custom directory will be ignored, with the exception of `custom/example.bash`. -Alternately, if you would like to keep your custom scripts under version control, you can set BASH_IT_CUSTOM in your `~/.bashrc` to another location outside of the `~/.bash_it` folder. +Alternately, if you would like to keep your custom scripts under version control, you can set `BASH_IT_CUSTOM` in your `~/.bashrc` to another location outside of the `~/.bash_it` folder. ## Themes -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 directly to the theme file. +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. + +Examples: + +```bash +# Use the "powerline-multiline" theme +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" +``` You can easily preview the themes in your own shell using `BASH_PREVIEW=true reload`. -If you've created your own custom prompts, I'd love it if you shared with everyone else! Just submit a Pull Request. +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). -**NOTE**: Bash-it and some themes use UTF-8 characters, so to avoid extrange behaviors in your terminal, set your locale to `LC_ALL=en_US.UTF-8` or the equivalent to your language if isn't American English. +**NOTE**: Bash-it and some themes use UTF-8 characters, so to avoid strange behavior in your terminal, set your locale to `LC_ALL=en_US.UTF-8` or the equivalent to your language if isn't American English. ## Uninstalling