Merge remote-tracking branch 'remotes/revans/master'
Conflicts: README.md install.sh plugins/available/docker.plugin.bashpull/261/head
commit
473f42de52
19
README.md
19
README.md
|
|
@ -9,8 +9,8 @@ Includes autocompletion, themes, aliases, custom functions, a few stolen pieces
|
|||
## Install
|
||||
|
||||
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)
|
||||
3. Edit your modified config (`~/.bash_profile` or `~/.bashrc`) file in order to customize bash-it.
|
||||
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.
|
||||
|
||||
**NOTE:**
|
||||
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`
|
||||
|
||||
#### 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
|
||||
|
||||
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]
|
||||
|
||||
[contribute]: https://github.com/revans/bash-it/contributors
|
||||
[pass password manager]: http://www.passwordstore.org/
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
49
install.sh
49
install.sh
|
|
@ -22,8 +22,7 @@ while true
|
|||
do
|
||||
read -p "Do you use Jekyll? (If you don't know what Jekyll is, answer 'n') [Y/N] " RESP
|
||||
|
||||
case $RESP
|
||||
in
|
||||
case $RESP in
|
||||
[yY])
|
||||
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"
|
||||
|
|
@ -53,31 +52,29 @@ function load_all() {
|
|||
}
|
||||
|
||||
function load_some() {
|
||||
file_type=$1
|
||||
for path in `ls $BASH_IT/${file_type}/available/[^_]*`
|
||||
do
|
||||
if [ ! -d "$BASH_IT/$file_type/enabled" ]
|
||||
then
|
||||
mkdir "$BASH_IT/$file_type/enabled"
|
||||
fi
|
||||
file_name=$(basename "$path")
|
||||
while true
|
||||
do
|
||||
read -p "Would you like to enable the ${file_name%%.*} $file_type? [Y/N] " RESP
|
||||
case $RESP in
|
||||
[yY])
|
||||
ln -s "../available/${file_name}" "$BASH_IT/$file_type/enabled"
|
||||
break
|
||||
;;
|
||||
[nN])
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Please choose y or n."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
file_type=$1
|
||||
[ -d "$BASH_IT/$file_type/enabled" ] || mkdir "$BASH_IT/$file_type/enabled"
|
||||
for path in `ls $BASH_IT/${file_type}/available/[^_]*`
|
||||
do
|
||||
file_name=$(basename "$path")
|
||||
while true; do
|
||||
read -s -n 1 -p "Would you like to enable the ${file_name%%.*} $file_type? [y/N] " RESP
|
||||
case $RESP in
|
||||
[yY])
|
||||
echo "Y"
|
||||
ln -s "../available/${file_name}" "$BASH_IT/$file_type/enabled"
|
||||
break
|
||||
;;
|
||||
[nN]|"")
|
||||
echo "N"
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo -e "\033[91mPlease choose y or n.\033[m"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
for type in "aliases" "plugins" "completion"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
# of boot2docker, or its configured for a different IP
|
||||
|
|
@ -23,3 +23,43 @@ function docker-remove-most-recent-image() {
|
|||
group 'docker'
|
||||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue