From ca52f5ce2f766aa7f3b85a767f4af7f09fcbac2a Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Mon, 11 May 2015 00:01:36 +0200 Subject: [PATCH 01/25] Fixed export option to work on Mac --- plugins/available/aws.plugin.bash | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/available/aws.plugin.bash b/plugins/available/aws.plugin.bash index 68fc4907..b9873359 100644 --- a/plugins/available/aws.plugin.bash +++ b/plugins/available/aws.plugin.bash @@ -61,9 +61,12 @@ function __awskeys_show { } function __awskeys_export { - local p_keys="$(__awskeys_get $1)" + local p_keys=( $(__awskeys_get $1 | tr -d " ") ) if [[ -n "${p_keys}" ]]; then - eval $(echo "${p_keys}" | tr -d " " | sed -r -e "s/(.+=)(.+)/export \U\1\E\2/") + for p_key in ${p_keys[@]}; do + local key="${p_key%=*}" + export "${key^^}=${p_key#*=}" + done export AWS_DEFAULT_PROFILE="$1" else echo "Profile $1 not found in credentials file" From ab08ca7d16eae2cd360bb0a9b0db02226a7ebf3a Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Mon, 11 May 2015 00:02:07 +0200 Subject: [PATCH 02/25] Minor changes and updated help messages --- plugins/available/aws.plugin.bash | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/plugins/available/aws.plugin.bash b/plugins/available/aws.plugin.bash index b9873359..fa194077 100644 --- a/plugins/available/aws.plugin.bash +++ b/plugins/available/aws.plugin.bash @@ -4,18 +4,12 @@ about-plugin 'AWS helper functions' function awskeys { about 'helper function for AWS credentials file' group 'aws' - if [[ $# -eq 0 ]]; then - __awskeys_help - elif [[ $# -eq 1 ]] && [[ "$1" = "list" ]]; then + if [[ $# -eq 1 ]] && [[ "$1" = "list" ]]; then __awskeys_list "$2" - elif [[ $# -eq 2 ]]; then - if [[ "$1" = "show" ]]; then - __awskeys_show "$2" - elif [[ "$1" = "export" ]]; then - __awskeys_export "$2" - else - __awskeys_help - fi + elif [[ $# -eq 2 ]] && [[ "$1" = "show" ]]; then + __awskeys_show "$2" + elif [[ $# -eq 2 ]] && [[ "$1" = "export" ]]; then + __awskeys_export "$2" else __awskeys_help fi @@ -26,9 +20,9 @@ function __awskeys_help { echo -e "Helper to AWS credentials file.\n" echo -e "Commands:\n" echo " help Show this help message" - echo " list List available credentials profiles" - echo " show Show the keys associated to a credentials profile" - echo " export Export a credentials profile keys as environment variables" + echo " list List available AWS credentials profiles" + echo " show Show the AWS keys associated to a credentials profile" + echo " export Export an AWS credentials profile keys as environment variables" } function __awskeys_get { From 9d7aa3b88204107559b1e8d718a6145e38b3adc7 Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Mon, 11 May 2015 00:02:27 +0200 Subject: [PATCH 03/25] Added remove option --- plugins/available/aws.plugin.bash | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/available/aws.plugin.bash b/plugins/available/aws.plugin.bash index fa194077..d434f876 100644 --- a/plugins/available/aws.plugin.bash +++ b/plugins/available/aws.plugin.bash @@ -6,6 +6,8 @@ function awskeys { group 'aws' if [[ $# -eq 1 ]] && [[ "$1" = "list" ]]; then __awskeys_list "$2" + elif [[ $# -eq 1 ]] && [[ "$1" = "remove" ]]; then + __awskeys_remove "$2" elif [[ $# -eq 2 ]] && [[ "$1" = "show" ]]; then __awskeys_show "$2" elif [[ $# -eq 2 ]] && [[ "$1" = "export" ]]; then @@ -23,6 +25,7 @@ function __awskeys_help { echo " list List available AWS credentials profiles" echo " show Show the AWS keys associated to a credentials profile" echo " export Export an AWS credentials profile keys as environment variables" + echo " remove Remove the AWS keys variables from the environment" } function __awskeys_get { @@ -67,3 +70,8 @@ function __awskeys_export { fi } +function __awskeys_remove { + unset AWS_DEFAULT_PROFILE + unset AWS_ACCESS_KEY_ID + unset AWS_SECRET_ACCESS_KEY +} From a25964560341a4e88c20495b5ede978b49747a52 Mon Sep 17 00:00:00 2001 From: "Kevin S. Clarke" Date: Tue, 12 May 2015 13:48:22 -0400 Subject: [PATCH 04/25] Add vagrant up log alias --- aliases/available/vagrant.aliases.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/aliases/available/vagrant.aliases.bash b/aliases/available/vagrant.aliases.bash index f8ff843f..cfedb657 100644 --- a/aliases/available/vagrant.aliases.bash +++ b/aliases/available/vagrant.aliases.bash @@ -3,6 +3,7 @@ about-alias 'vagrant aliases' # Aliases alias vup="vagrant up" +alias vupl="vagrant up 2>&1 | tee vagrant.log" alias vh="vagrant halt" alias vs="vagrant suspend" alias vr="vagrant resume" From 74244236cd8afee3c0068bcc84c2b7bac2b9d031 Mon Sep 17 00:00:00 2001 From: "Kevin S. Clarke" Date: Tue, 12 May 2015 22:23:55 -0400 Subject: [PATCH 05/25] Fix startup error with docker alias --- aliases/available/docker.aliases.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aliases/available/docker.aliases.bash b/aliases/available/docker.aliases.bash index 24c21f5b..9134bd19 100644 --- a/aliases/available/docker.aliases.bash +++ b/aliases/available/docker.aliases.bash @@ -3,7 +3,7 @@ about-alias 'docker abbreviations' alias dklc='docker ps -l' # List last Docker container alias dklcid='docker ps -l -q' # List last Docker container ID -alias dklcip="docker inspect `dklcid` | grep IPAddress | cut -d '\"' -f 4" # Get IP of last Docker container +alias dklcip="docker inspect `docker ps -l -q` | grep IPAddress | cut -d '\"' -f 4" # Get IP of last Docker container alias dkps='docker ps' # List running Docker containers alias dkpsa='docker ps -a' # List all Docker containers alias dki='docker images' # List Docker images From 98f5be98dcb46c7d8137ec8d546d2780b355fed3 Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Wed, 13 May 2015 23:09:03 +0200 Subject: [PATCH 06/25] Now, really fixed (and tested) the export option in Mac --- plugins/available/aws.plugin.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/available/aws.plugin.bash b/plugins/available/aws.plugin.bash index d434f876..0c5deba0 100644 --- a/plugins/available/aws.plugin.bash +++ b/plugins/available/aws.plugin.bash @@ -62,7 +62,7 @@ function __awskeys_export { if [[ -n "${p_keys}" ]]; then for p_key in ${p_keys[@]}; do local key="${p_key%=*}" - export "${key^^}=${p_key#*=}" + export "$(echo ${key} | tr [:lower:] [:upper:])=${p_key#*=}" done export AWS_DEFAULT_PROFILE="$1" else From 172c6a0aea2240a25eb39c84da0805e5736282d8 Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Wed, 13 May 2015 23:11:04 +0200 Subject: [PATCH 07/25] Renamed remove option to unset --- plugins/available/aws.plugin.bash | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/plugins/available/aws.plugin.bash b/plugins/available/aws.plugin.bash index 0c5deba0..4f4887d2 100644 --- a/plugins/available/aws.plugin.bash +++ b/plugins/available/aws.plugin.bash @@ -6,8 +6,8 @@ function awskeys { group 'aws' if [[ $# -eq 1 ]] && [[ "$1" = "list" ]]; then __awskeys_list "$2" - elif [[ $# -eq 1 ]] && [[ "$1" = "remove" ]]; then - __awskeys_remove "$2" + elif [[ $# -eq 1 ]] && [[ "$1" = "unset" ]]; then + __awskeys_unset "$2" elif [[ $# -eq 2 ]] && [[ "$1" = "show" ]]; then __awskeys_show "$2" elif [[ $# -eq 2 ]] && [[ "$1" = "export" ]]; then @@ -25,7 +25,7 @@ function __awskeys_help { echo " list List available AWS credentials profiles" echo " show Show the AWS keys associated to a credentials profile" echo " export Export an AWS credentials profile keys as environment variables" - echo " remove Remove the AWS keys variables from the environment" + echo " unset Unset the AWS keys variables from the environment" } function __awskeys_get { @@ -70,8 +70,6 @@ function __awskeys_export { fi } -function __awskeys_remove { - unset AWS_DEFAULT_PROFILE - unset AWS_ACCESS_KEY_ID - unset AWS_SECRET_ACCESS_KEY +function __awskeys_unset { + unset AWS_DEFAULT_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY } From 4252199edac04103dee95d0a898ca40437bbebdd Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Miranda Date: Thu, 14 May 2015 18:45:00 -0300 Subject: [PATCH 08/25] Adding emacs daemon and emacsclient -t aliases for emacs-nox users --- aliases/available/emacs.aliases.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aliases/available/emacs.aliases.bash b/aliases/available/emacs.aliases.bash index 0efcf780..58956df3 100644 --- a/aliases/available/emacs.aliases.bash +++ b/aliases/available/emacs.aliases.bash @@ -5,6 +5,8 @@ case $OSTYPE in linux*) alias em='emacs' alias e='emacsclient -n' + alias et='emacsclient -t' + alias ed='emacs --daemon' alias E='SUDO_EDITOR="emacsclient" sudo -e' ;; darwin*) From 60ce75715152fbd3b71a6b1ce93388240507f257 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Mon, 18 May 2015 10:06:32 +0200 Subject: [PATCH 09/25] Changed check for drush excecutable This should help with #480... --- completion/available/drush.completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/completion/available/drush.completion.bash b/completion/available/drush.completion.bash index a65def6f..4f3f784f 100644 --- a/completion/available/drush.completion.bash +++ b/completion/available/drush.completion.bash @@ -7,7 +7,7 @@ # http://github.com/drush-ops/drush/blob/master/drush.complete.sh # Ensure drush is available. -which drush > /dev/null || alias drush &> /dev/null || return +which drush &> /dev/null || alias drush &> /dev/null || return __drush_ps1() { f="${TMPDIR:-/tmp/}/drush-env/drush-drupal-site-$$" From 1172973d89d449c69f081370dc332c81e921e9a8 Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Wed, 20 May 2015 20:49:36 +0200 Subject: [PATCH 10/25] Fixed regex in __awskeys_list function --- plugins/available/aws.plugin.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/available/aws.plugin.bash b/plugins/available/aws.plugin.bash index 4f4887d2..c8920e38 100644 --- a/plugins/available/aws.plugin.bash +++ b/plugins/available/aws.plugin.bash @@ -36,7 +36,7 @@ function __awskeys_get { } function __awskeys_list { - local credentials_list="$(egrep '^\[ *[a-zA-Z0-0_-]+ *\]$' ~/.aws/credentials)" + local credentials_list="$(egrep '^\[ *[a-zA-Z0-9_-]+ *\]$' ~/.aws/credentials)" if [[ -n $"{credentials_list}" ]]; then echo -e "Available credentials profiles:\n" for cred in ${credentials_list}; do From 9693b39da6ea10475083b1c106c58b3989f7f84d Mon Sep 17 00:00:00 2001 From: jitakirin Date: Thu, 21 May 2015 21:12:18 +0100 Subject: [PATCH 11/25] Port sudo indicator to powerline theme This ports sudo indicator feature to powerline theme, originally added to powerline-multiline theme in PR #452. --- themes/powerline/powerline.theme.bash | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index 1bc4eca9..4e7320cb 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -4,7 +4,7 @@ THEME_PROMPT_SEPARATOR="" SHELL_SSH_CHAR=" " SHELL_THEME_PROMPT_COLOR=32 -SHELL_SSH_THEME_PROMPT_COLOR=208 +SHELL_THEME_PROMPT_COLOR_SUDO=202 VIRTUALENV_CHAR="ⓔ " VIRTUALENV_THEME_PROMPT_COLOR=35 @@ -37,13 +37,17 @@ function set_rgb_color { } 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}) \u ${normal}" - LAST_THEME_COLOR=${SHELL_THEME_PROMPT_COLOR} + SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR} + if sudo -n true &>/dev/null; then + SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR_SUDO} fi + if [[ -n "${SSH_CLIENT}" ]]; then + SHELL_PROMPT="${SHELL_SSH_CHAR}\u@\h" + else + SHELL_PROMPT="\u" + fi + SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_PROMPT_COLOR}) ${SHELL_PROMPT} ${normal}" + LAST_THEME_COLOR=${SHELL_PROMPT_COLOR} } function powerline_virtualenv_prompt { From 473b3f2075917843ed1ef741ca272d6a680a4637 Mon Sep 17 00:00:00 2001 From: jitakirin Date: Fri, 22 May 2015 08:43:34 +0100 Subject: [PATCH 12/25] Abuse uptime to check if sudo requires password The ``sudo -n true`` trick doesn't work on OS X. --- themes/powerline/powerline.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index 4e7320cb..cb90b2e0 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -38,7 +38,7 @@ function set_rgb_color { function powerline_shell_prompt { SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR} - if sudo -n true &>/dev/null; then + if sudo -n uptime 2>&1 |grep -q "load"; then SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR_SUDO} fi if [[ -n "${SSH_CLIENT}" ]]; then From b8649312e44f5b38fb121387ea786d9f2537bfd7 Mon Sep 17 00:00:00 2001 From: jitakirin Date: Fri, 22 May 2015 08:51:13 +0100 Subject: [PATCH 13/25] Style fix --- themes/powerline/powerline.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index cb90b2e0..944414db 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -38,7 +38,7 @@ function set_rgb_color { function powerline_shell_prompt { SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR} - if sudo -n uptime 2>&1 |grep -q "load"; then + if sudo -n uptime 2>&1 | grep -q "load"; then SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR_SUDO} fi if [[ -n "${SSH_CLIENT}" ]]; then From 595ae1ab07194330a5741c47a740940a8ff4bccd Mon Sep 17 00:00:00 2001 From: jitakirin Date: Fri, 22 May 2015 08:51:32 +0100 Subject: [PATCH 14/25] Make powerline-multiline use the same check for sudo Reduces number of subprocesses to check for passwordless sudo by 1. --- themes/powerline-multiline/powerline-multiline.theme.bash | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/themes/powerline-multiline/powerline-multiline.theme.bash b/themes/powerline-multiline/powerline-multiline.theme.bash index 232a2a8e..6940b9ee 100644 --- a/themes/powerline-multiline/powerline-multiline.theme.bash +++ b/themes/powerline-multiline/powerline-multiline.theme.bash @@ -55,8 +55,7 @@ function set_rgb_color { function powerline_shell_prompt { SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR} - CAN_I_RUN_SUDO=$(sudo -n uptime 2>&1 | grep "load" | wc -l) - if [ ${CAN_I_RUN_SUDO} -gt 0 ]; then + if sudo -n uptime 2>&1 | grep -q "load"; then SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR_SUDO} fi SEGMENT_AT_RIGHT=0 From c14f94dc9cac210d5abebd24d767f266c25fdd1a Mon Sep 17 00:00:00 2001 From: Miguel Morales Date: Sun, 24 May 2015 18:06:48 -0500 Subject: [PATCH 15/25] Add emacs terminal alias --- aliases/available/emacs.aliases.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/aliases/available/emacs.aliases.bash b/aliases/available/emacs.aliases.bash index 0efcf780..48355a33 100644 --- a/aliases/available/emacs.aliases.bash +++ b/aliases/available/emacs.aliases.bash @@ -4,6 +4,7 @@ about-alias 'emacs editor' case $OSTYPE in linux*) alias em='emacs' + alias et='emacs -nw' alias e='emacsclient -n' alias E='SUDO_EDITOR="emacsclient" sudo -e' ;; From 567289185a9bb913de900d41abf622c6eff21d2d Mon Sep 17 00:00:00 2001 From: Miguel Morales Date: Sun, 24 May 2015 18:11:14 -0500 Subject: [PATCH 16/25] Alias collides with httpie binary It would be nice to still have this alias but not colliding with the awesome httpie tool: https://github.com/jakubroztocil/httpie --- plugins/available/python.plugin.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/available/python.plugin.bash b/plugins/available/python.plugin.bash index 51970786..3215bfda 100644 --- a/plugins/available/python.plugin.bash +++ b/plugins/available/python.plugin.bash @@ -1,11 +1,11 @@ cite about-plugin -about-plugin 'alias "http" to SimpleHTTPServer' +about-plugin 'alias "https" to SimpleHTTPServer' if [ $(uname) = "Linux" ] then - alias http='python2 -m SimpleHTTPServer' + alias https='python2 -m SimpleHTTPServer' else - alias http='python -m SimpleHTTPServer' + alias https='python -m SimpleHTTPServer' fi function pyedit() { From 68fa2cf9d2225534e9843dd84cc76d9b5fdc2baf Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Miranda Date: Sun, 24 May 2015 22:06:03 -0300 Subject: [PATCH 17/25] my tmux personal aliases --- aliases/available/tmux.aliases.bash | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 aliases/available/tmux.aliases.bash diff --git a/aliases/available/tmux.aliases.bash b/aliases/available/tmux.aliases.bash new file mode 100644 index 00000000..1a984499 --- /dev/null +++ b/aliases/available/tmux.aliases.bash @@ -0,0 +1,10 @@ +cite 'about-alias' +about-alias 'Tmux terminal multiplexer' + +case $OSTYPE in + linux*) + alias txl='tmux ls' + alias txn='tmux new -s' + alias txa='tmux a -t' + ;; +esac From 26290954b2458d67c63a72bd1e018d5ee4baea22 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Miranda Date: Mon, 25 May 2015 09:31:06 -0300 Subject: [PATCH 18/25] Removed linux only validation --- aliases/available/tmux.aliases.bash | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/aliases/available/tmux.aliases.bash b/aliases/available/tmux.aliases.bash index 1a984499..1b07f149 100644 --- a/aliases/available/tmux.aliases.bash +++ b/aliases/available/tmux.aliases.bash @@ -1,10 +1,6 @@ cite 'about-alias' about-alias 'Tmux terminal multiplexer' -case $OSTYPE in - linux*) - alias txl='tmux ls' - alias txn='tmux new -s' - alias txa='tmux a -t' - ;; -esac +alias txl='tmux ls' +alias txn='tmux new -s' +alias txa='tmux a -t' From 76faf90f908bf62ee13272d25c95a460c63518db Mon Sep 17 00:00:00 2001 From: jitakirin Date: Tue, 26 May 2015 10:25:56 +0100 Subject: [PATCH 19/25] Fix dkrmui alias (delete untagged images) The docker images subcommand was returning all columns due to unescaped '$3' in awk filter. This was throwing a lot of errors as rmi tried to remove non-existent images. In any case docker images has a flag to filter and only show dangling image IDs which makes this simpler. --- aliases/available/docker.aliases.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aliases/available/docker.aliases.bash b/aliases/available/docker.aliases.bash index 9134bd19..87b525db 100644 --- a/aliases/available/docker.aliases.bash +++ b/aliases/available/docker.aliases.bash @@ -9,7 +9,7 @@ alias dkpsa='docker ps -a' # List all Docker containers 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 rmi $(docker images | grep "^" | awk "{print $3}")' # Delete all untagged Docker images +alias dkrmui='docker images -q -f dangling=true |xargs -r docker rmi' # Delete all untagged Docker images 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 From cf3728c5aad9e94bf412ad22a5f311c95a75210e Mon Sep 17 00:00:00 2001 From: Ivan Povalyukhin Date: Sat, 30 May 2015 00:26:22 -0700 Subject: [PATCH 20/25] [pathmunge] added function to prevent duplicates in PATH variable --- lib/helpers.bash | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/helpers.bash b/lib/helpers.bash index 9c4c4dbc..c5ae9cd1 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -361,3 +361,21 @@ all_groups () cat $file | sort | uniq rm $file } + +if ! type pathmunge > /dev/null 2>&1 +then + function pathmunge () { + _about 'prevent duplicate directories in you PATH variable' + _group 'lib helpers' + _example 'pathmunge /path/to/dir is equivalent to PATH=/path/to/dir:$PATH' + _example 'pathmunge /path/to/dir after is equivalent to PATH=$PATH:/path/to/dir' + + if ! [[ $PATH =~ (^|:)$1($|:) ]] ; then + if [ "$2" = "after" ] ; then + export PATH=$PATH:$1 + else + export PATH=$1:$PATH + fi + fi + } +fi From 575551e42b4ea48c822aaea89bfd312d011e79a8 Mon Sep 17 00:00:00 2001 From: Ivan Povalyukhin Date: Sat, 30 May 2015 00:27:05 -0700 Subject: [PATCH 21/25] [pathmunge] fix duplicates in PATH variable for nginx and node plugins --- plugins/available/nginx.plugin.bash | 5 +---- plugins/available/node.plugin.bash | 6 ++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/plugins/available/nginx.plugin.bash b/plugins/available/nginx.plugin.bash index 8e8b7346..c540a23a 100644 --- a/plugins/available/nginx.plugin.bash +++ b/plugins/available/nginx.plugin.bash @@ -1,11 +1,8 @@ cite about-plugin about-plugin 'manage your nginx service' -# Set the path nginx export NGINX_PATH='/opt/nginx' - -# Add nginx to the path -export PATH=$PATH:$NGINX_PATH/sbin +pathmunge $NGINX_PATH/sbin after function nginx_reload() { about 'reload your nginx config' diff --git a/plugins/available/node.plugin.bash b/plugins/available/node.plugin.bash index 06b158e7..f0467cef 100644 --- a/plugins/available/node.plugin.bash +++ b/plugins/available/node.plugin.bash @@ -1,9 +1,7 @@ cite about-plugin about-plugin 'Node.js helper functions' -export PATH=./node_modules/.bin:$PATH +pathmunge ./node_modules/.bin # Make sure the global npm prefix is on the path -[[ `which npm` ]] && export PATH=$(npm config get prefix)/bin:$PATH - - +[[ `which npm` ]] && pathmunge $(npm config get prefix)/bin From 2ffed6f52a92d240d6487dcbf9ad38aa55650a5d Mon Sep 17 00:00:00 2001 From: Miguel Morales Date: Sat, 30 May 2015 14:17:11 -0500 Subject: [PATCH 22/25] Change alias to a more intuitive name --- plugins/available/python.plugin.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/available/python.plugin.bash b/plugins/available/python.plugin.bash index 3215bfda..ad7e4069 100644 --- a/plugins/available/python.plugin.bash +++ b/plugins/available/python.plugin.bash @@ -1,11 +1,11 @@ cite about-plugin -about-plugin 'alias "https" to SimpleHTTPServer' +about-plugin 'alias "shttp" to SimpleHTTPServer' if [ $(uname) = "Linux" ] then - alias https='python2 -m SimpleHTTPServer' + alias shttp='python2 -m SimpleHTTPServer' else - alias https='python -m SimpleHTTPServer' + alias shttp='python -m SimpleHTTPServer' fi function pyedit() { From a20b19bc218116008c090e751b9f3f523ef06293 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Mon, 1 Jun 2015 19:08:29 +0200 Subject: [PATCH 23/25] Added aliases for Atom.io editor --- aliases/available/atom.aliases.bash | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 aliases/available/atom.aliases.bash diff --git a/aliases/available/atom.aliases.bash b/aliases/available/atom.aliases.bash new file mode 100644 index 00000000..e9d427c7 --- /dev/null +++ b/aliases/available/atom.aliases.bash @@ -0,0 +1,5 @@ +cite 'about-alias' +about-alias 'Atom.io editor abbreviations' + +alias a='atom' +alias ah='atom .' From fcbe9aa75184b673c75dc1c332617dc0825ad81a Mon Sep 17 00:00:00 2001 From: Antti Ahti Date: Fri, 5 Jun 2015 15:40:58 +0300 Subject: [PATCH 24/25] Fix ips command for platforms without ifconfig --- plugins/available/base.plugin.bash | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/available/base.plugin.bash b/plugins/available/base.plugin.bash index aa35a708..accd3610 100644 --- a/plugins/available/base.plugin.bash +++ b/plugins/available/base.plugin.bash @@ -5,7 +5,15 @@ function ips () { about 'display all ip addresses for this host' group 'base' - ifconfig | awk '/inet /{ print $2 }' + if command -v ifconfig &>/dev/null + then + ifconfig | awk '/inet /{ print $2 }' + elif command -v ip &>/dev/null + then + ip addr | grep -oP 'inet \K[\d.]+' + else + echo "You don't have ifconfig or ip command installed!" + fi } function down4me () From 7bbc077990fd83116451e69a6b38843bc5d6fa54 Mon Sep 17 00:00:00 2001 From: Eddie Hurtig Date: Fri, 5 Jun 2015 17:56:05 -0400 Subject: [PATCH 25/25] Check for PTY before attempting to use bind After running a dist upgrade on one of my Ubuntu 14.04 test workstations I started receiving errors after a graphical login. This should also fix remote ssh login problems as seen in http://superuser.com/questions/892658/remote-ssh-commands-bash-bind-warning-line-editing-not-enabled --- plugins/available/history.plugin.bash | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/available/history.plugin.bash b/plugins/available/history.plugin.bash index 512bbf92..386e05d1 100644 --- a/plugins/available/history.plugin.bash +++ b/plugins/available/history.plugin.bash @@ -1,4 +1,7 @@ # enter a few characters and press UpArrow/DownArrow # to search backwards/forwards through the history -bind '"":history-search-backward' -bind '"":history-search-forward' +if [ -t 1 ]; +then + bind '"":history-search-backward' + bind '"":history-search-forward' +fi