standardize plugins, update metadata

add about-plugin metadata
chmod -x plugins
cleanup filenames to standardize on x.plugin.bash format
only plugin files intended to be executable from the command line should
contain a shebang line, and should be a+x.
pull/134/head
Erich Smith 2012-05-11 23:27:03 -04:00
parent 254d4459e2
commit 55e77deac1
27 changed files with 214 additions and 53 deletions

View File

@ -1,7 +1,5 @@
#!/usr/bin/env bash
cite about-plugin cite about-plugin
about-plugin generic and miscellaneous tools about-plugin miscellaneous tools
ips () ips ()
{ {

View File

@ -1,7 +1,5 @@
#!/usr/bin/env bash
cite about-plugin cite about-plugin
about-plugin query and display info about your battery charge level about-plugin display info about your battery charge level
battery_percentage(){ battery_percentage(){
about 'displays battery charge as a percentage of full (100%)' about 'displays battery charge as a percentage of full (100%)'

View File

@ -1,5 +1,3 @@
#!/usr/bin/env bash
# Directory stack navigation: # Directory stack navigation:
# #
# Add to stack with: pu /path/to/directory # Add to stack with: pu /path/to/directory
@ -7,6 +5,9 @@
# Show stack with: d # Show stack with: d
# Jump to location by number. # Jump to location by number.
cite about-plugin
about-plugin directory stack navigation
# Show directory stack # Show directory stack
alias d="dirs -v -l" alias d="dirs -v -l"
@ -31,6 +32,9 @@ alias pu="pushd"
alias po="popd" alias po="popd"
function dirs-help() { function dirs-help() {
about directory navigation alias usage
group dirs
echo "Directory Navigation Alias Usage" echo "Directory Navigation Alias Usage"
echo echo
echo "Use the power of directory stacking to move" echo "Use the power of directory stacking to move"
@ -64,10 +68,18 @@ fi
alias L='cat ~/.dirs' alias L='cat ~/.dirs'
G () { # goes to distination dir otherwise , stay in the dir G () { # goes to distination dir otherwise , stay in the dir
about goes to destination dir
param 1: directory
example '$ G ..'
group dirs
cd ${1:-$(pwd)} ; cd ${1:-$(pwd)} ;
} }
S () { # SAVE a BOOKMARK S () { # SAVE a BOOKMARK
about save a bookmark
group dirs
sed "/$@/d" ~/.dirs > ~/.dirs1; sed "/$@/d" ~/.dirs > ~/.dirs1;
\mv ~/.dirs1 ~/.dirs; \mv ~/.dirs1 ~/.dirs;
echo "$@"=\"`pwd`\" >> ~/.dirs; echo "$@"=\"`pwd`\" >> ~/.dirs;
@ -75,6 +87,9 @@ S () { # SAVE a BOOKMARK
} }
R () { # remove a BOOKMARK R () { # remove a BOOKMARK
about remove a bookmark
group dirs
sed "/$@/d" ~/.dirs > ~/.dirs1; sed "/$@/d" ~/.dirs > ~/.dirs1;
\mv ~/.dirs1 ~/.dirs; \mv ~/.dirs1 ~/.dirs;
} }

View File

@ -1,3 +1,5 @@
cite about-plugin
about-plugin one command to extract them all...
extract () { extract () {
if [ $# -ne 1 ] if [ $# -ne 1 ]
then then

View File

@ -584,7 +584,8 @@ fasd [-A|-D] [paths ...]
fasd --init env fasd --init env
case $- in case $- in
*i*) alias fasd=$BASH_IT'/plugins/enabled/fasd.bash' *i*) cite about-plugin
about-plugin navigate 'frecently' used files and directories
eval "$(fasd --init auto)" eval "$(fasd --init auto)"
;; ;;
*) # assume being executed as an executable *) # assume being executed as an executable

View File

@ -1,26 +1,42 @@
#!/usr/bin/env bash cite about-plugin
about-plugin git helper functions
function git_remote { function git_remote {
about 'adds remote $GIT_HOSTING:$1 to current repo'
group git
echo "Running: git remote add origin ${GIT_HOSTING}:$1.git" echo "Running: git remote add origin ${GIT_HOSTING}:$1.git"
git remote add origin $GIT_HOSTING:$1.git git remote add origin $GIT_HOSTING:$1.git
} }
function git_first_push { function git_first_push {
about push into origin refs/heads/master
group git
echo "Running: git push origin master:refs/heads/master" echo "Running: git push origin master:refs/heads/master"
git push origin master:refs/heads/master git push origin master:refs/heads/master
} }
function git_remove_missing_files() { function git_remove_missing_files() {
about "git rm's missing files"
group git
git ls-files -d -z | xargs -0 git update-index --remove git ls-files -d -z | xargs -0 git update-index --remove
} }
# Adds files to git's exclude file (same as .gitignore) # Adds files to git's exclude file (same as .gitignore)
function local-ignore() { function local-ignore() {
about adds file or path to git exclude file
param 1: file or path fragment to ignore
group git
echo "$1" >> .git/info/exclude echo "$1" >> .git/info/exclude
} }
# get a quick overview for your git repo # get a quick overview for your git repo
function git_info() { function git_info() {
about overview for your git repo
group git
if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]; then if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]; then
# print informations # print informations
echo "git repo overview" echo "git repo overview"
@ -55,6 +71,9 @@ function git_info() {
} }
function git_stats { function git_stats {
about display stats per author
group git
# awesome work from https://github.com/esc/git-stats # awesome work from https://github.com/esc/git-stats
# including some modifications # including some modifications

View File

@ -1,14 +1,25 @@
#!/usr/bin/env bash cite about-plugin
about-plugin hg helper functions
hg_dirty() { hg_dirty() {
about displays dirty status of hg repository
group hg
hg status --no-color 2> /dev/null \ hg status --no-color 2> /dev/null \
| awk '$1 == "?" { print "?" } $1 != "?" { print "!" }' \ | awk '$1 == "?" { print "?" } $1 != "?" { print "!" }' \
| sort | uniq | head -c1 | sort | uniq | head -c1
} }
hg_in_repo() { hg_in_repo() {
about 'determine if pwd is an hg repo'
group hg
[[ `hg branch 2> /dev/null` ]] && echo 'on ' [[ `hg branch 2> /dev/null` ]] && echo 'on '
} }
hg_branch() { hg_branch() {
about display current hg branch
group hg
hg branch 2> /dev/null hg branch 2> /dev/null
} }

View File

@ -1,16 +1,22 @@
#!/usr/bin/env bash # The install directory is hard-coded. TODO: allow the directory to be specified on the command line.
#
# The install directory is hard-coded. TOOD: allow the directory to be specified on the command line. cite about-plugin
# about-plugin download jquery files into current project
[[ -z "$JQUERY_VERSION_NUMBER" ]] && JQUERY_VERSION_NUMBER="1.6.1" [[ -z "$JQUERY_VERSION_NUMBER" ]] && JQUERY_VERSION_NUMBER="1.6.1"
[[ -z "$JQUERY_UI_VERSION_NUMBER" ]] && JQUERY_UI_VERSION_NUMBER="1.8.13" [[ -z "$JQUERY_UI_VERSION_NUMBER" ]] && JQUERY_UI_VERSION_NUMBER="1.8.13"
function rails_jquery { function rails_jquery {
about 'download rails.js into public/javascripts'
group javascript
curl -o public/javascripts/rails.js http://github.com/rails/jquery-ujs/raw/master/src/rails.js curl -o public/javascripts/rails.js http://github.com/rails/jquery-ujs/raw/master/src/rails.js
} }
function jquery_install { function jquery_install {
about 'download jquery.js into public/javascripts'
group javascripts
if [ -z "$1" ] if [ -z "$1" ]
then then
version=$JQUERY_VERSION_NUMBER version=$JQUERY_VERSION_NUMBER
@ -21,6 +27,9 @@ function jquery_install {
} }
function jquery_ui_install { function jquery_ui_install {
about 'download jquery_us.js into public/javascripts'
group javascripts
if [ -z "$1" ] if [ -z "$1" ]
then then
version=$JQUERY_UI_VERSION_NUMBER version=$JQUERY_UI_VERSION_NUMBER

View File

@ -1,6 +1,11 @@
#!/usr/bin/env bash cite about-plugin
about-plugin manage your jekyll site
editpost() { editpost() {
about edit a post
param 1: site directory
group jekyll
unset SITE unset SITE
if [ -z "$1" ] if [ -z "$1" ]
then then
@ -50,6 +55,10 @@ editpost() {
} }
newpost() { newpost() {
about create a new post
param 1: site directory
group jekyll
unset SITE unset SITE
if [ -z "$1" ] if [ -z "$1" ]
then then
@ -257,6 +266,10 @@ newpost() {
} }
function testsite() { function testsite() {
about launches local jekyll server
param 1: site directory
group jekyll
unset SITE unset SITE
if [ -z "$1" ] if [ -z "$1" ]
then then
@ -285,6 +298,10 @@ function testsite() {
} }
function buildsite() { function buildsite() {
about builds site
param 1: site directory
group jekyll
unset SITE unset SITE
if [ -z "$1" ] if [ -z "$1" ]
then then
@ -314,6 +331,10 @@ function buildsite() {
} }
function deploysite() { function deploysite() {
about 'rsyncs site to remote host'
param 1: site directory
group jekyll
unset SITE unset SITE
if [ -z "$1" ] if [ -z "$1" ]
then then

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash cite about-plugin
about-plugin use mactex
# add mactex to the path if its present # add mactex to the path if its present
MACTEX_PATH=/usr/local/texlive/2009/bin/universal-darwin MACTEX_PATH=/usr/local/texlive/2009/bin/universal-darwin

View File

@ -1,6 +1,10 @@
#!/usr/bin/env bash cite about-plugin
about-plugin manage your nginx service
function nginx_reload() { function nginx_reload() {
about reload your nginx config
group nginx
FILE="${NGINX_PATH}/logs/nginx.pid" FILE="${NGINX_PATH}/logs/nginx.pid"
if [ -e $FILE ]; then if [ -e $FILE ]; then
echo "Reloading NGINX..." echo "Reloading NGINX..."
@ -13,6 +17,9 @@ function nginx_reload() {
} }
function nginx_stop() { function nginx_stop() {
about stop nginx
group nginx
FILE="${NGINX_PATH}/logs/nginx.pid" FILE="${NGINX_PATH}/logs/nginx.pid"
if [ -e $FILE ]; then if [ -e $FILE ]; then
echo "Stopping NGINX..." echo "Stopping NGINX..."
@ -25,6 +32,9 @@ function nginx_stop() {
} }
function nginx_start() { function nginx_start() {
about start nginx
group nginx
FILE="${NGINX_PATH}/sbin/nginx" FILE="${NGINX_PATH}/sbin/nginx"
if [ -e $FILE ]; then if [ -e $FILE ]; then
echo "Starting NGINX..." echo "Starting NGINX..."
@ -35,6 +45,9 @@ function nginx_start() {
} }
function nginx_restart() { function nginx_restart() {
about restart nginx
group nginx
FILE="${NGINX_PATH}/logs/nginx.pid" FILE="${NGINX_PATH}/logs/nginx.pid"
if [ -e $FILE ]; then if [ -e $FILE ]; then
echo "Stopping NGINX..." echo "Stopping NGINX..."

View File

@ -5,6 +5,9 @@
# Implemented by Tim Caswell <tim@creationix.com> # Implemented by Tim Caswell <tim@creationix.com>
# with much bash help from Matthew Ranney # with much bash help from Matthew Ranney
cite about-plugin
about-plugin 'node version manager, as a bash function'
export NVM_DIR=$HOME/.nvm export NVM_DIR=$HOME/.nvm
if [ ! -d "$NVM_DIR" ]; then if [ ! -d "$NVM_DIR" ]; then
@ -75,6 +78,10 @@ print_versions()
nvm() nvm()
{ {
about 'Node Version Manager'
param '1: command, see nvm help'
group nvm
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
nvm help nvm help
return return

View File

@ -1,6 +1,10 @@
#!/usr/bin/env bash cite about-plugin
about-plugin 'osx-specific functions'
function tab() { function tab() {
about 'opens a new terminal tab'
group osx
osascript 2>/dev/null <<EOF osascript 2>/dev/null <<EOF
tell application "System Events" tell application "System Events"
tell process "Terminal" to keystroke "t" using command down tell process "Terminal" to keystroke "t" using command down
@ -15,6 +19,10 @@ EOF
# this one switches your os x dock between 2d and 3d # this one switches your os x dock between 2d and 3d
# thanks to savier.zwetschge.org # thanks to savier.zwetschge.org
function dock-switch() { function dock-switch() {
about 'switch dock between 2d and 3d'
param '1: "2d" or "3d"'
example '$ dock-switch 2d'
group osx
if [ $(uname) = "Darwin" ]; then if [ $(uname) = "Darwin" ]; then
@ -39,6 +47,10 @@ function dock-switch() {
# Download a file and open it in Preview # Download a file and open it in Preview
function prevcurl() { function prevcurl() {
about 'download a file and open it in Preview'
param '1: url'
group 'osx'
if [ ! $(uname) = "Darwin" ] if [ ! $(uname) = "Darwin" ]
then then
echo "This function only works with Mac OS X" echo "This function only works with Mac OS X"

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash cite about-plugin
about-plugin '"alias "http" to SimpleHTTPServer'
if [ $(uname) = "Linux" ] if [ $(uname) = "Linux" ]
then then

View File

@ -1,6 +1,8 @@
#!/usr/bin/env bash
# Load rbebv, if you are using it # Load rbebv, if you are using it
cite about-plugin
about-plugin 'load rbenv, if you are using it'
export PATH="$HOME/.rbenv/bin:$PATH" export PATH="$HOME/.rbenv/bin:$PATH"
[[ `which rbenv` ]] && eval "$(rbenv init -)" [[ `which rbenv` ]] && eval "$(rbenv init -)"

View File

@ -1,4 +1,10 @@
#!/usr/bin/env bash cite about-plugin
about-plugin 'adds "remove_gem" function'
function remove_gem { function remove_gem {
about 'removes installed gem'
param '1: installed gem name'
group ruby
gem list | grep $1 | awk '{ print $1; }' | xargs sudo gem uninstall gem list | grep $1 | awk '{ print $1; }' | xargs sudo gem uninstall
} }

View File

@ -1,6 +1,8 @@
#!/usr/bin/env bash
# Load RVM, if you are using it # Load RVM, if you are using it
cite about-plugin
about-plugin 'load rvm, if you are using it'
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm [[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
# Check to make sure that RVM is actually loaded before adding # Check to make sure that RVM is actually loaded before adding

View File

@ -0,0 +1,19 @@
cite about-plugin
about-plugin 'ssh helper functions'
function add_ssh() {
about 'add entry to ssh config'
param '1: host'
param '2: hostname'
param '3: user'
group 'ssh'
echo -en "\n\nHost $1\n HostName $2\n User $3\n ServerAliveInterval 30\n ServerAliveCountMax 120" >> ~/.ssh/config
}
function sshlist() {
about 'list hosts defined in ssh config'
group 'ssh'
awk '$1 ~ /Host$/ { print $2 }' ~/.ssh/config
}

View File

@ -1,9 +0,0 @@
#!/usr/bin/env bash
function add_ssh() {
echo -en "\n\nHost $1\n HostName $2\n User $3\n ServerAliveInterval 30\n ServerAliveCountMax 120" >> ~/.ssh/config
}
function sshlist() {
awk '$1 ~ /Host$/ { print $2 }' ~/.ssh/config
}

View File

@ -1,8 +1,21 @@
#!/usr/bin/env bash cite about-plugin
about-plugin 'svn helper functions'
rm_svn(){ rm_svn(){
about 'remove ".svn" files from directory'
param '1: directory to search for files'
group 'svn'
if [ -z "$1" ]; then
reference rm_svn
return
fi
find $1 -name .svn -print0 | xargs -0 rm -rf find $1 -name .svn -print0 | xargs -0 rm -rf
} }
svn_add(){ svn_add(){
svn status | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add about 'add to svn repo'
group 'svn'
svn status | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add
} }

View File

@ -1,2 +1,6 @@
# make sure that tmux is launched in 256 color mode # make sure that tmux is launched in 256 color mode
cite about-plugin
about-plugin 'make sure that tmux is launched in 256 color mode'
alias tmux="TERM=xterm-256color tmux" alias tmux="TERM=xterm-256color tmux"

View File

@ -1,3 +1,4 @@
#!/usr/bin/env bash cite about-plugin
about-plugin 'sources tmuxinator script if available'
[[ -s $HOME/.tmuxinator/scripts/tmuxinator ]] && . $HOME/.tmuxinator/scripts/tmuxinator [[ -s $HOME/.tmuxinator/scripts/tmuxinator ]] && . $HOME/.tmuxinator/scripts/tmuxinator

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash cite about-plugin
about-plugin 'set up vagrant autocompletion'
_vagrant() _vagrant()
{ {
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"

View File

@ -1,19 +1,30 @@
#!/usr/bin/env bash
# make sure virtualenvwrapper is enabled if available # make sure virtualenvwrapper is enabled if available
cite about-plugin
about-plugin 'virtualenvwrapper helper functions'
[[ `which virtualenvwrapper.sh` ]] && . virtualenvwrapper.sh [[ `which virtualenvwrapper.sh` ]] && . virtualenvwrapper.sh
# create a new virtualenv for this directory
function mkvenv { function mkvenv {
about 'create a new virtualenv for this directory'
group virtualenv
cwd=`basename \`pwd\`` cwd=`basename \`pwd\``
mkvirtualenv --no-site-packages --distribute $cwd mkvirtualenv --no-site-packages --distribute $cwd
} }
# create a new virtualenv for the branch you're currently in
function mkvbranch { function mkvbranch {
about 'create a new virtualenv for the current branch'
group virtualenv
mkvirtualenv --no-site-packages --distribute "$(basename `pwd`)@$(git_prompt_info)" mkvirtualenv --no-site-packages --distribute "$(basename `pwd`)@$(git_prompt_info)"
} }
function wovbranch { function wovbranch {
about 'sets workon branch'
group virtualenv
workon "$(basename `pwd`)@$(git_prompt_info)" workon "$(basename `pwd`)@$(git_prompt_info)"
} }

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash cite about-plugin
about-plugin 'maintains a jump-list of the directories you actually use'
about-plugin ' z is DEPRECATED, use fasd instead'
# maintains a jump-list of the directories you actually use
#
# INSTALL: # INSTALL:
# * put something like this in your .bashrc: # * put something like this in your .bashrc:
# . /path/to/z.sh # . /path/to/z.sh

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash cite about-plugin
about-plugin 'source into environment when cding to directories'
if [[ -n "${ZSH_VERSION}" ]] if [[ -n "${ZSH_VERSION}" ]]
then __array_offset=0 then __array_offset=0
else __array_offset=1 else __array_offset=1