Help files. Added the rest of bash it
parent
a7d1ee0c02
commit
a4d0242dd0
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,177 @@
|
|||
#!bash
|
||||
#
|
||||
# git-flow-completion
|
||||
# ===================
|
||||
#
|
||||
# Bash completion support for [git-flow](http://github.com/nvie/gitflow)
|
||||
#
|
||||
# The contained completion routines provide support for completing:
|
||||
#
|
||||
# * git-flow init and version
|
||||
# * feature, hotfix and release branches
|
||||
# * remote feature branch names (for `git-flow feature track`)
|
||||
#
|
||||
#
|
||||
# Installation
|
||||
# ------------
|
||||
#
|
||||
# To achieve git-flow completion nirvana:
|
||||
#
|
||||
# 0. Install git-completion.
|
||||
#
|
||||
# 1. Install this file. Either:
|
||||
#
|
||||
# a. Place it in a `bash-completion.d` folder:
|
||||
#
|
||||
# * /etc/bash-completion.d
|
||||
# * /usr/local/etc/bash-completion.d
|
||||
# * ~/bash-completion.d
|
||||
#
|
||||
# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.sh) and put the following line in
|
||||
# your .bashrc:
|
||||
#
|
||||
# source ~/.git-flow-completion.sh
|
||||
#
|
||||
# 2. If you are using Git < 1.7.1: Edit git-completion.sh and add the following line to the giant
|
||||
# $command case in _git:
|
||||
#
|
||||
# flow) _git_flow ;;
|
||||
#
|
||||
#
|
||||
# The Fine Print
|
||||
# --------------
|
||||
#
|
||||
# Copyright (c) 2010 [Justin Hileman](http://justinhileman.com)
|
||||
#
|
||||
# Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/)
|
||||
|
||||
_git_flow ()
|
||||
{
|
||||
local subcommands="init feature release hotfix"
|
||||
local subcommand="$(__git_find_subcommand "$subcommands")"
|
||||
if [ -z "$subcommand" ]; then
|
||||
__gitcomp "$subcommands"
|
||||
return
|
||||
fi
|
||||
|
||||
case "$subcommand" in
|
||||
feature)
|
||||
__git_flow_feature
|
||||
return
|
||||
;;
|
||||
release)
|
||||
__git_flow_release
|
||||
return
|
||||
;;
|
||||
hotfix)
|
||||
__git_flow_hotfix
|
||||
return
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=()
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__git_flow_feature ()
|
||||
{
|
||||
local subcommands="list start finish publish track diff rebase checkout pull"
|
||||
local subcommand="$(__git_find_subcommand "$subcommands")"
|
||||
if [ -z "$subcommand" ]; then
|
||||
__gitcomp "$subcommands"
|
||||
return
|
||||
fi
|
||||
|
||||
case "$subcommand" in
|
||||
pull)
|
||||
__gitcomp "$(__git_remotes)"
|
||||
return
|
||||
;;
|
||||
checkout|finish|diff|rebase)
|
||||
__gitcomp "$(__git_flow_list_features)"
|
||||
return
|
||||
;;
|
||||
publish)
|
||||
__gitcomp "$(comm -23 <(__git_flow_list_features) <(__git_flow_list_remote_features))"
|
||||
return
|
||||
;;
|
||||
track)
|
||||
__gitcomp "$(__git_flow_list_remote_features)"
|
||||
return
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=()
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__git_flow_list_features ()
|
||||
{
|
||||
git flow feature list 2> /dev/null | tr -d ' |*'
|
||||
}
|
||||
|
||||
__git_flow_list_remote_features ()
|
||||
{
|
||||
git branch -r 2> /dev/null | grep "origin/$(__git_flow_feature_prefix)" | awk '{ sub(/^origin\/$(__git_flow_feature_prefix)/, "", $1); print }'
|
||||
}
|
||||
|
||||
__git_flow_feature_prefix ()
|
||||
{
|
||||
git config gitflow.prefix.feature 2> /dev/null || echo "feature/"
|
||||
}
|
||||
|
||||
__git_flow_release ()
|
||||
{
|
||||
local subcommands="list start finish"
|
||||
local subcommand="$(__git_find_subcommand "$subcommands")"
|
||||
if [ -z "$subcommand" ]; then
|
||||
__gitcomp "$subcommands"
|
||||
return
|
||||
fi
|
||||
|
||||
case "$subcommand" in
|
||||
finish)
|
||||
__gitcomp "$(__git_flow_list_releases)"
|
||||
return
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=()
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
__git_flow_list_releases ()
|
||||
{
|
||||
git flow release list 2> /dev/null
|
||||
}
|
||||
|
||||
__git_flow_hotfix ()
|
||||
{
|
||||
local subcommands="list start finish"
|
||||
local subcommand="$(__git_find_subcommand "$subcommands")"
|
||||
if [ -z "$subcommand" ]; then
|
||||
__gitcomp "$subcommands"
|
||||
return
|
||||
fi
|
||||
|
||||
case "$subcommand" in
|
||||
finish)
|
||||
__gitcomp "$(__git_flow_list_hotfixes)"
|
||||
return
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=()
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__git_flow_list_hotfixes ()
|
||||
{
|
||||
git flow hotfix list 2> /dev/null
|
||||
}
|
||||
|
||||
# temporarily wrap __git_find_on_cmdline() for backwards compatibility
|
||||
if [ -z "`type -t __git_find_subcommand`" ]; then
|
||||
alias __git_find_subcommand=__git_find_on_cmdline
|
||||
fi
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
# Bash completion support for Rake, Ruby Make.
|
||||
|
||||
export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}
|
||||
|
||||
_rakecomplete() {
|
||||
if [ -f Rakefile ]; then
|
||||
recent=`ls -t .rake_tasks~ Rakefile **/*.rake 2> /dev/null | head -n 1`
|
||||
if [[ $recent != '.rake_tasks~' ]]; then
|
||||
rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~
|
||||
fi
|
||||
COMPREPLY=($(compgen -W "`cat .rake_tasks~`" -- ${COMP_WORDS[COMP_CWORD]}))
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
complete -o default -o nospace -F _rakecomplete rake
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
function rh {
|
||||
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
|
||||
}
|
||||
|
||||
function ips {
|
||||
ifconfig | grep "inet " | awk '{ print $2 }'
|
||||
}
|
||||
|
||||
|
||||
# View man documentation in Preview
|
||||
pman () {
|
||||
man -t "${1}" | open -f -a /Applications/Preview.app/
|
||||
}
|
||||
|
||||
|
||||
pcurl() {
|
||||
curl "${1}" | open -f -a /Applications/Preview.app/
|
||||
}
|
||||
|
||||
pri() {
|
||||
ri -T "${1}" | open -f -a /Applications/Preview.app/
|
||||
}
|
||||
|
||||
|
||||
# disk usage per directory
|
||||
usage ()
|
||||
{
|
||||
if [ $1 ]
|
||||
then
|
||||
du -hd $1
|
||||
else
|
||||
du -hd 1
|
||||
fi
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
function git_remote {
|
||||
echo "Running: git remote add origin ${GIT_HOSTING}:$1.git"
|
||||
git remote add origin $GIT_HOSTING:$1.git
|
||||
}
|
||||
|
||||
function git_first_push {
|
||||
echo "Running: git push origin master:refs/heads/master"
|
||||
git push origin master:refs/heads/master
|
||||
}
|
||||
|
||||
function git_remove_missing_files() {
|
||||
git ls-files -d -z | xargs -0 git update-index --remove
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
function rails_jquery {
|
||||
curl -o public/javascripts/rails.js http://github.com/rails/jquery-ujs/raw/master/src/rails.js
|
||||
}
|
||||
|
||||
function jquery_install {
|
||||
curl -o public/javascripts/jquery.js http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
|
||||
}
|
||||
|
||||
function jquery_ui_install {
|
||||
curl -o public/javascripts/jquery_ui.js http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
|
||||
function nginx_reload() {
|
||||
FILE="${NGINX_PATH}/logs/nginx.pid"
|
||||
if [ -e $FILE ]; then
|
||||
echo "Reloading NGINX..."
|
||||
PID=`cat $NGINX_PATH/logs/nginx.pid`
|
||||
sudo kill -HUP $PID
|
||||
else
|
||||
echo "Nginx pid file not found"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
function nginx_stop() {
|
||||
FILE="${NGINX_PATH}/logs/nginx.pid"
|
||||
if [ -e $FILE ]; then
|
||||
echo "Stopping NGINX..."
|
||||
PID=`cat $NGINX_PATH/logs/nginx.pid`
|
||||
sudo kill -INT $PID
|
||||
else
|
||||
echo "Nginx pid file not found"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
function nginx_start() {
|
||||
FILE="${NGINX_PATH}/sbin/nginx"
|
||||
if [ -e $FILE ]; then
|
||||
echo "Starting NGINX..."
|
||||
sudo $NGINX_PATH/sbin/nginx
|
||||
else
|
||||
echo "Couldn't start nginx"
|
||||
fi
|
||||
}
|
||||
|
||||
function nginx_restart() {
|
||||
FILE="${NGINX_PATH}/logs/nginx.pid"
|
||||
if [ -e $FILE ]; then
|
||||
echo "Stopping NGINX..."
|
||||
PID=`cat $NGINX_PATH/logs/nginx.pid`
|
||||
sudo kill -INT $PID
|
||||
sleep 1
|
||||
echo "Starting NGINX..."
|
||||
sudo $NGINX_PATH/sbin/nginx
|
||||
else
|
||||
echo "Nginx pid file not found"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Desktop Programs
|
||||
alias fireworks="open -a '/Applications/Adobe Fireworks CS3/Adobe Fireworks CS3.app'"
|
||||
alias photoshop="open -a '/Applications/Adobe Photoshop CS3/Adobe Photoshop.app'"
|
||||
alias preview="open -a '/Applications/Preview.app'"
|
||||
alias xcode="open -a '/Developer/Applications/Xcode.app'"
|
||||
alias filemerge="open -a '/Developer/Applications/Utilities/FileMerge.app'"
|
||||
alias safari="open -a safari"
|
||||
alias firefox="open -a firefox"
|
||||
alias dashcode="open -a dashcode"
|
||||
|
||||
function plugin-help() {
|
||||
echo "Plugin Help Screen"
|
||||
echo
|
||||
rails-help
|
||||
echo
|
||||
git-help
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
alias em="emacs"
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Aliases
|
||||
alias g='git'
|
||||
alias gst='git status'
|
||||
alias gs='git status'
|
||||
alias gl='git pull'
|
||||
alias gup='git fetch && git rebase'
|
||||
alias gp='git push'
|
||||
alias gd='git diff | mate'
|
||||
alias gdv='git diff -w "$@" | vim -R -'
|
||||
alias gc='git commit -v'
|
||||
alias gca='git commit -v -a'
|
||||
alias gb='git branch'
|
||||
alias gba='git branch -a'
|
||||
alias gcount='git shortlog -sn'
|
||||
alias gcp='git cherry-pick'
|
||||
|
||||
function git-help() {
|
||||
echo "Git Custom Aliases Usage"
|
||||
echo
|
||||
echo " g = git"
|
||||
echo " gst/gs = git status"
|
||||
echo " gl = git pull"
|
||||
echo " gup = git fetch && git rebase"
|
||||
echo " gp = git push"
|
||||
echo " gd = git diff | mate"
|
||||
echo " gdv = git diff -w \"$@\" | vim -R -"
|
||||
echo " gc = git commit -v"
|
||||
echo " gca = git commit -v -a"
|
||||
echo " gb = git branch"
|
||||
echo " gba = git branch -a"
|
||||
echo " gcount = git shortlog -sn"
|
||||
echo " gcp = git cherry-pick"
|
||||
echo
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
function tab() {
|
||||
osascript 2>/dev/null <<EOF
|
||||
tell application "System Events"
|
||||
tell process "Terminal" to keystroke "t" using command down
|
||||
end
|
||||
tell application "Terminal"
|
||||
activate
|
||||
do script with command "cd \"$PWD\"; $*" in window 1
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Rails Commands
|
||||
alias r='rails'
|
||||
alias rg='rails g'
|
||||
alias rs='rails s'
|
||||
alias rc='rails c'
|
||||
alias rn='rails new'
|
||||
alias rd='rails dbconsole'
|
||||
alias rp='rails plugin'
|
||||
alias ra='rails application'
|
||||
alias rd='rails destroy'
|
||||
|
||||
alias ss='script/server'
|
||||
alias sc='script/console'
|
||||
alias restart_app='touch tmp/restart.txt'
|
||||
alias devlog='tail -f log/development.log'
|
||||
|
||||
|
||||
function rails-help() {
|
||||
echo "Rails Aliases Usage"
|
||||
echo
|
||||
echo " r = rails"
|
||||
echo " rg = rails generate"
|
||||
echo " rs/ss = rails server"
|
||||
echo " rc/sc = rails console"
|
||||
echo " rn = rails new"
|
||||
echo " rd = rails dbconsole"
|
||||
echo " rp = rails plugin"
|
||||
echo " ra = rails application"
|
||||
echo " rd = rails destroy"
|
||||
echo " restartapp = touch tmp/restart.txt"
|
||||
echo " devlog = tail -f log/development.log"
|
||||
echo
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
function remove_gem {
|
||||
gem list | grep $1 | awk '{ print $1; }' | xargs sudo gem uninstall
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
switch () {
|
||||
rvm $1
|
||||
local v=$(rvm_version)
|
||||
rvm wrapper $1 textmate
|
||||
echo "Switch to Ruby version: "$v
|
||||
}
|
||||
|
||||
rvm_default () {
|
||||
rvm --default $1
|
||||
rvm wrapper $1 textmate
|
||||
}
|
||||
|
||||
function rvm_version () {
|
||||
ruby --version
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
rm_svn(){
|
||||
find $1 -name .svn -print0 | xargs -0 rm -rf
|
||||
}
|
||||
|
||||
svn_add(){
|
||||
svn status | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Textmate
|
||||
alias e='mate . &'
|
||||
alias et='mate app config db lib public script test spec config.ru Gemfile Rakefile README &'
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
alias v='mvim --remote-silent'
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Load RVM
|
||||
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
|
||||
|
||||
# Add rvm gems and nginx to the path
|
||||
export PATH=$PATH:~/.gem/ruby/1.8/bin:/opt/nginx/sbin
|
||||
|
||||
# Path to the bash it configuration
|
||||
export BASH=$HOME/.bash_it
|
||||
|
||||
# Lock and Load a custom theme file
|
||||
# location /.bash_it/themes/
|
||||
export BASH_THEME='bobby'
|
||||
|
||||
# Your place for hosting Git repos. I use this for private repos.
|
||||
export GIT_HOSTING='git@git.domain.org'
|
||||
|
||||
# Set my editor and git editor
|
||||
export EDITOR="/usr/bin/mate -w"
|
||||
export GIT_EDITOR='/usr/bin/mate -w'
|
||||
|
||||
# Set the path nginx
|
||||
export NGINX_PATH='/opt/nginx'
|
||||
|
||||
# Don't check mail when opening terminal.
|
||||
unset MAILCHECK
|
||||
|
||||
# Load Bash It
|
||||
source $BASH/bash_it.sh
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Normal Colors
|
||||
GREEN=$'\e[0;32m'
|
||||
RED=$'\e[0;31m'
|
||||
BLUE=$'\e[0;34m'
|
||||
WHITE=$'\e[1;37m'
|
||||
BLACK=$'\e[0;30m'
|
||||
YELLOW=$'\e[0;33m'
|
||||
PURPLE=$'\e[0;35m'
|
||||
CYAN=$'\e[0;36m'
|
||||
GRAY=$'\e[1;30m'
|
||||
PINK=$'\e[37;1;35m'
|
||||
ORANGE=$'\e[33;40m'
|
||||
|
||||
# Revert color back to the normal color
|
||||
NORMAL=$'\e[00m'
|
||||
|
||||
# LIGHT COLORS
|
||||
LIGHT_BLUE=$'\e[1;34m'
|
||||
LIGHT_GREEN=$'\e[1;32m'
|
||||
LIGHT_CYAN=$'\e[1;36m'
|
||||
LIGHT_RED=$'\e[1;31m'
|
||||
LIGHT_PURPLE=$'\e[1;35m'
|
||||
LIGHT_YELLOW=$'\e[1;33m'
|
||||
LIGHT_GRAY=$'\e[0;37m'
|
||||
|
||||
|
||||
# Stolen from Steve Losh
|
||||
function prompt_char {
|
||||
git branch >/dev/null 2>/dev/null && echo '±' && return
|
||||
hg root >/dev/null 2>/dev/null && echo '☿' && return
|
||||
echo '○'
|
||||
}
|
||||
|
||||
function parse_git_dirty {
|
||||
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
|
||||
}
|
||||
|
||||
function parse_git_branch {
|
||||
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
export PS1='${LIGHT_BLUE}$(prompt_char)${LIGHT_GREEN} $(parse_git_branch) ${ORANGE}\h ${NORMAL}in ${GREEN}\w ${NORMAL}→ '
|
||||
Loading…
Reference in New Issue