Merge remote-tracking branch 'remotes/revans/master'

Conflicts:
	README.md
	install.sh
	plugins/available/docker.plugin.bash
pull/261/head
Hector Rivas 2015-02-05 14:10:54 +00:00
commit 473f42de52
4 changed files with 98 additions and 29 deletions

View File

@ -9,8 +9,8 @@ Includes autocompletion, themes, aliases, custom functions, a few stolen pieces
## Install ## Install
1. Check a clone of this repo: `git clone https://github.com/revans/bash-it.git ~/.bash_it` 1. Check a clone of this repo: `git clone https://github.com/revans/bash-it.git ~/.bash_it`
2. Run `~/.bash_it/install.sh` (it automatically backs up your `~/.bash_profile` or ~/.bashrc, depends on your OS) 2. Run `~/.bash_it/install.sh` (it automatically backs up your `~/.bash_profile` or `~/.bashrc`, depends on your OS)
3. Edit your modified config (`~/.bash_profile` or `~/.bashrc`) file in order to customize bash-it. 3. Edit your modified config (`~/.bash_profile` or `~/.bashrc`) file in order to customize bash it.
**NOTE:** **NOTE:**
The install script will also prompt you asking if you use [Jekyll](https://github.com/mojombo/jekyll). The install script will also prompt you asking if you use [Jekyll](https://github.com/mojombo/jekyll).
@ -81,6 +81,20 @@ Set `SCM_GIT_SHOW_DETAILS` to 'false' to **don't show** it:
* `export SCM_GIT_SHOW_DETAILS=false` * `export SCM_GIT_SHOW_DETAILS=false`
#### pass function renamed to passgen
The Bash it `pass` function has been renamed to `passgen` in order to avoid a naming conflict with the [pass password manager]. In order to minimize the impact on users of the legacy Bash it `pass` function, Bash it will create the alias `pass` that calls the new `passgen` function if the `pass` password manager command is not found on the `PATH` (default behavior).
This behavior can be overridden with the `BASH_IT_LEGACY_PASS` flag as follows:
Set `BASH_IT_LEGACY_PASS` to 'true' to force Bash it to always **create** the `pass` alias to `passgen`:
* `export BASH_IT_LEGACY_PASS=true`
Unset `BASH_IT_LEGACY_PASS` to have Bash it **return to default behavior**:
* `unset BASH_IT_LEGACY_PASS`
## Help out ## Help out
I think everyone has their own custom scripts accumulated over time. And so, following in the footsteps of oh-my-zsh, bash it is a framework for easily customizing your bash shell. Everyone's got a custom toolbox, so let's start making them even better, **as a community!** I think everyone has their own custom scripts accumulated over time. And so, following in the footsteps of oh-my-zsh, bash it is a framework for easily customizing your bash shell. Everyone's got a custom toolbox, so let's start making them even better, **as a community!**
@ -95,3 +109,4 @@ Thanks, and happing bashing!
* [List of contributors][contribute] * [List of contributors][contribute]
[contribute]: https://github.com/revans/bash-it/contributors [contribute]: https://github.com/revans/bash-it/contributors
[pass password manager]: http://www.passwordstore.org/

View File

@ -0,0 +1,17 @@
cite 'about-alias'
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 dkps='docker ps' # List running Docker containers
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 "^<none>" | awk "{print $3}")' # 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
alias dkre='docker-runtime-environment' # List environmental variables of the supplied image ID
alias dkelc='docker exec -it `dklcid` bash' # Enter last container (works with Docker 1.3 and above)

View File

@ -22,8 +22,7 @@ while true
do do
read -p "Do you use Jekyll? (If you don't know what Jekyll is, answer 'n') [Y/N] " RESP read -p "Do you use Jekyll? (If you don't know what Jekyll is, answer 'n') [Y/N] " RESP
case $RESP case $RESP in
in
[yY]) [yY])
cp $HOME/.bash_it/template/jekyllconfig.template.bash $HOME/.jekyllconfig cp $HOME/.bash_it/template/jekyllconfig.template.bash $HOME/.jekyllconfig
echo "Copied the template .jekyllconfig into your home directory. Edit this file to customize bash-it for using the Jekyll plugins" echo "Copied the template .jekyllconfig into your home directory. Edit this file to customize bash-it for using the Jekyll plugins"
@ -53,31 +52,29 @@ function load_all() {
} }
function load_some() { function load_some() {
file_type=$1 file_type=$1
for path in `ls $BASH_IT/${file_type}/available/[^_]*` [ -d "$BASH_IT/$file_type/enabled" ] || mkdir "$BASH_IT/$file_type/enabled"
do for path in `ls $BASH_IT/${file_type}/available/[^_]*`
if [ ! -d "$BASH_IT/$file_type/enabled" ] do
then file_name=$(basename "$path")
mkdir "$BASH_IT/$file_type/enabled" while true; do
fi read -s -n 1 -p "Would you like to enable the ${file_name%%.*} $file_type? [y/N] " RESP
file_name=$(basename "$path") case $RESP in
while true [yY])
do echo "Y"
read -p "Would you like to enable the ${file_name%%.*} $file_type? [Y/N] " RESP ln -s "../available/${file_name}" "$BASH_IT/$file_type/enabled"
case $RESP in break
[yY]) ;;
ln -s "../available/${file_name}" "$BASH_IT/$file_type/enabled" [nN]|"")
break echo "N"
;; break
[nN]) ;;
break *)
;; echo -e "\033[91mPlease choose y or n.\033[m"
*) ;;
echo "Please choose y or n." esac
;;
esac
done
done done
done
} }
for type in "aliases" "plugins" "completion" for type in "aliases" "plugins" "completion"

View File

@ -1,5 +1,5 @@
cite about-plugin cite about-plugin
about-plugin 'Helpers to get Docker setup correctly for boot2docker' about-plugin 'Helpers to get Docker setup correctly for boot2docker and to more easily work with Docker'
# Note, this might need to be different if you have an older version # Note, this might need to be different if you have an older version
# of boot2docker, or its configured for a different IP # of boot2docker, or its configured for a different IP
@ -23,3 +23,43 @@ function docker-remove-most-recent-image() {
group 'docker' group 'docker'
docker images | head -2 | tail -1 | awk '{print $3}' | xargs docker rmi docker images | head -2 | tail -1 | awk '{print $3}' | xargs docker rmi
} }
function docker-remove-images() {
about 'attempt to remove images with supplied tags or all if no tags are supplied'
group 'docker'
if [ -z "$1" ]; then
docker rmi $(docker images -q)
else
DOCKER_IMAGES=""
for IMAGE_ID in $@; do DOCKER_IMAGES="$DOCKER_IMAGES\|$IMAGE_ID"; done
# Find the image IDs for the supplied tags
ID_ARRAY=($(docker images | grep "${DOCKER_IMAGES:2}" | awk {'print $3'}))
# Strip out duplicate IDs before attempting to remove the image(s)
docker rmi $(echo ${ID_ARRAY[@]} | tr ' ' '\n' | sort -u | tr '\n' ' ')
fi
}
function docker-image-dependencies() {
about 'attempt to create a Graphiz image of the supplied image ID dependencies'
group 'docker'
if hash dot 2>/dev/null; then
OUT=$(mktemp -t docker-viz-XXXX.png)
docker images -viz | dot -Tpng > $OUT
case $OSTYPE in
linux*)
xdg-open $OUT
;;
darwin*)
open $OUT
;;
esac
else
>&2 echo "Can't show dependencies; Graphiz is not installed"
fi
}
function docker-runtime-environment() {
about 'attempt to list the environmental variables of the supplied image ID'
group 'docker'
docker run "$@" env
}