Added help screens.

pull/3/head
Robert R Evans 2010-10-02 15:04:24 -07:00
parent 6491f50a91
commit a7d1ee0c02
24 changed files with 29 additions and 2304 deletions

4
.gitignore vendored
View File

@ -1 +1,3 @@
.DS_Store .DS_Store
custom/*.bash
!custom/example.bash

View File

@ -1,6 +1,6 @@
# Bash it # Bash it
Bash it is a mash up of my own bash commands and scripts, other bash stuff I have found and a shameless ripoff of oh-my-zsh. :) 'Bash it' is a mash up of my own bash commands and scripts, other bash stuff I have found and a shameless ripoff of oh-my-zsh. :)
From what I remember, I've incorporated things I have found from the following: From what I remember, I've incorporated things I have found from the following:
@ -11,19 +11,19 @@ Includes some autocompletion tools, theming support, aliases, custom functions,
## Install ## Install
Check a clone of this repo. You can view what a sample ~/.bash\_profile looks like in template/bash\_profile.bash-template. If you wanted to use that template, make sure to make a backup of your current ~/.bash\_profile file. Check a clone of this repo. You can view what a sample ~/.bash\_profile looks like in template/bash\_profile.template.bash. If you wanted to use that template, make sure to make a backup of your current ~/.bash\_profile file.
<pre><code> <pre><code>
git clone http://github.com/revans/bash-it.git git clone http://github.com/revans/bash-it.git
cp ~/.bash_profile ~/.bash_profile_original cp ~/.bash_profile ~/.bash_profile_original
cp template/bash_profile.bash-template ~/.bash_profile cp template/bash_profile.template.bash ~/.bash_profile
</code></pre> </code></pre>
## Themes ## Themes
Currently, there is only 1 theme, bobby. There is a base.bash that includes various colors that can then be used to create custom themes. There is support for git in the prompt: showing what branch you're on, if you've committed locally or not, etc. I'm working on adding mercurial support as well. Currently, there is only 1 theme, 'bobby'. There is a base.theme.bash that includes various colors that can then be used to create custom themes. There is support for git in the prompt: showing what branch you're on, if you've committed locally or not, etc. I'm working on adding mercurial support as well.
## Help out! ## Help out!
Just like oh-my-zsh, bash it is meant for the community. If you have things to add, want to add a theme, etc. please fork this project and send me a pull request. Just like oh-my-zsh, 'bash it' is meant for the community. If you have things to add, want to add a theme, etc. please fork this project and send me a pull request.

View File

@ -20,7 +20,7 @@ do
source $config_file source $config_file
done done
unset config_file
# Plugins # Plugins
PLUGINS="${BASH}/plugins/*.bash" PLUGINS="${BASH}/plugins/*.bash"
for config_file in $PLUGINS for config_file in $PLUGINS
@ -47,4 +47,18 @@ CUSTOM="${BASH}/custom/*.bash"
for config_file in $CUSTOM for config_file in $CUSTOM
do do
source $config_file source $config_file
done done
#
# Custom Help
function bash-it() {
echo "Welcome to Bash It!"
echo
echo "Here is a list of commands you can use to get help screens for specific pieces of Bash it:"
echo
echo " rails-help This will list out all the aliases you can use with rails."
echo " git-help This will list out all the aliases you can use with git."
echo
}

File diff suppressed because it is too large Load Diff

View File

@ -1,177 +0,0 @@
#!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

View File

@ -1,17 +0,0 @@
#!/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

View File

@ -1,36 +0,0 @@
#!/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
}

View File

@ -1,15 +0,0 @@
#!/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
}

View File

@ -1,13 +0,0 @@
#!/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
}

View File

@ -1,50 +0,0 @@
#!/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
}

View File

@ -17,4 +17,7 @@ alias -- -="cd -" # Go back
# Shell History # Shell History
alias h='history' alias h='history'
# # Directory
alias md='mkdir -p'
alias rd=rmdir
alias d='dirs -v'

View File

@ -8,4 +8,4 @@ export GREP_COLOR='1;33'
export LSCOLORS='Gxfxcxdxdxegedabagacad' export LSCOLORS='Gxfxcxdxdxegedabagacad'
# Load the theme # Load the theme
source "$BASH/themes/$BASH_THEME/$BASH_THEME.bash" source "$BASH/themes/$BASH_THEME/$BASH_THEME.theme.bash"

View File

@ -1,11 +0,0 @@
#!/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"

View File

@ -1,16 +0,0 @@
#!/bin/bash
# Aliases
alias g='git'
alias gst='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'

View File

@ -1,13 +0,0 @@
#!/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
}

View File

@ -1,17 +0,0 @@
#!/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'

View File

@ -1,4 +0,0 @@
#!/bin/bash
function remove_gem {
gem list | grep $1 | awk '{ print $1; }' | xargs sudo gem uninstall
}

View File

@ -1,16 +0,0 @@
#!/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
}

View File

@ -1,8 +0,0 @@
#!/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
}

View File

@ -1,6 +0,0 @@
#!/bin/bash
# Textmate
alias e='mate . &'
alias et='mate app config db lib public script test spec config.ru Gemfile Rakefile README &'
alias em="emacs"

View File

@ -1,4 +0,0 @@
#!/bin/bash
# VIM
alias v='mvim --remote-silent'

View File

@ -1,30 +0,0 @@
#!/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

View File

@ -1,42 +0,0 @@
#!/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)]/"
}

View File

@ -1,2 +0,0 @@
#!/bin/bash
export PS1='${LIGHT_BLUE}$(prompt_char)${LIGHT_GREEN} $(parse_git_branch) ${ORANGE}\h ${NORMAL}in ${GREEN}\w ${NORMAL}→ '