update plugin management
parent
8051a8520e
commit
08e439c4f0
|
|
@ -29,10 +29,10 @@ function reload_plugins() {
|
||||||
_load_bash_it_files "plugins"
|
_load_bash_it_files "plugins"
|
||||||
}
|
}
|
||||||
|
|
||||||
show_plugins ()
|
bash-it-plugins ()
|
||||||
{
|
{
|
||||||
about summarizes available bash_it plugins
|
about 'summarizes available bash_it plugins'
|
||||||
group lib
|
group 'lib'
|
||||||
|
|
||||||
typeset f
|
typeset f
|
||||||
typeset enabled
|
typeset enabled
|
||||||
|
|
@ -47,18 +47,66 @@ show_plugins ()
|
||||||
printf "%-20s%-10s%s\n" "$(basename $f | cut -d'.' -f1)" " [$enabled]" "$(cat $f | metafor about-plugin)"
|
printf "%-20s%-10s%s\n" "$(basename $f | cut -d'.' -f1)" " [$enabled]" "$(cat $f | metafor about-plugin)"
|
||||||
done
|
done
|
||||||
printf '\n%s\n' 'to enable a plugin, do:'
|
printf '\n%s\n' 'to enable a plugin, do:'
|
||||||
printf '%s\n' '$ enable_plugin <plugin name>'
|
printf '%s\n' '$ enable-plugin <plugin name> -or- $ enable-plugin all'
|
||||||
printf '\n%s\n' 'to disable a plugin, do:'
|
printf '\n%s\n' 'to disable a plugin, do:'
|
||||||
printf '%s\n' '$ disable_plugin <plugin name>'
|
printf '%s\n' '$ disable-plugin <plugin name> -or- $ disable-plugin all'
|
||||||
}
|
}
|
||||||
|
|
||||||
enable_plugin ()
|
disable-plugin ()
|
||||||
{
|
{
|
||||||
about enables bash_it plugin
|
about 'disables bash_it plugin'
|
||||||
param 1: plugin name
|
param '1: plugin name'
|
||||||
example '$ enable_plugin rvm'
|
example '$ disable_plugin rvm'
|
||||||
group lib
|
group 'lib'
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
reference disable_plugin
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "all" ]; then
|
||||||
|
typeset f plugin
|
||||||
|
for f in $BASH_IT/plugins/available/*.bash
|
||||||
|
do
|
||||||
|
plugin=$(basename $f)
|
||||||
|
if [ -h $BASH_IT/plugins/enabled/$plugin ]; then
|
||||||
|
rm $BASH_IT/plugins/enabled/$(basename $plugin)
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
typeset plugin=$(ls $BASH_IT/plugins/enabled/$1.*bash 2>/dev/null | head -1)
|
||||||
|
if [ ! -h $plugin ]; then
|
||||||
|
printf '%s\n' 'sorry, that does not appear to be an enabled plugin.'
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
rm $BASH_IT/plugins/enabled/$(basename $plugin)
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '%s\n' "$1 disabled."
|
||||||
|
}
|
||||||
|
|
||||||
|
enable-plugin ()
|
||||||
|
{
|
||||||
|
about 'enables bash_it plugin'
|
||||||
|
param '1: plugin name'
|
||||||
|
example '$ enable_plugin rvm'
|
||||||
|
group 'lib'
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
reference enable_plugin
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "all" ]; then
|
||||||
|
typeset f plugin
|
||||||
|
for f in $BASH_IT/plugins/available/*.bash
|
||||||
|
do
|
||||||
|
plugin=$(basename $f)
|
||||||
|
if [ ! -h $BASH_IT/plugins/enabled/$plugin ]; then
|
||||||
|
ln -s $BASH_IT/plugins/available/$plugin $BASH_IT/plugins/enabled/$plugin
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
typeset plugin=$(ls $BASH_IT/plugins/available/$1.*bash 2>/dev/null | head -1)
|
typeset plugin=$(ls $BASH_IT/plugins/available/$1.*bash 2>/dev/null | head -1)
|
||||||
if [ -z "$plugin" ]; then
|
if [ -z "$plugin" ]; then
|
||||||
printf '%s\n' 'sorry, that does not appear to be an available plugin.'
|
printf '%s\n' 'sorry, that does not appear to be an available plugin.'
|
||||||
|
|
@ -72,32 +120,15 @@ enable_plugin ()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -s $BASH_IT/plugins/available/$plugin $BASH_IT/plugins/enabled/$plugin
|
ln -s $BASH_IT/plugins/available/$plugin $BASH_IT/plugins/enabled/$plugin
|
||||||
printf '%s\n' "$1 is enabled."
|
|
||||||
|
|
||||||
reload_plugins
|
|
||||||
printf '%s\n' 'plugins reloaded.'
|
|
||||||
}
|
|
||||||
|
|
||||||
disable_plugin ()
|
|
||||||
{
|
|
||||||
about disables bash_it plugin
|
|
||||||
param 1: plugin name
|
|
||||||
example '$ disable_plugin rvm'
|
|
||||||
group lib
|
|
||||||
|
|
||||||
typeset plugin=$(ls $BASH_IT/plugins/enabled/$1.*bash 2>/dev/null | head -1)
|
|
||||||
if [ -z "$plugin" ]; then
|
|
||||||
printf '%s\n' 'sorry, that does not appear to be an enabled plugin.'
|
|
||||||
return
|
|
||||||
fi
|
fi
|
||||||
rm $BASH_IT/plugins/enabled/$(basename $plugin)
|
|
||||||
printf '%s\n' "$1 is disabled, and will be unavailable when you open a new terminal."
|
printf '%s\n' "$1 enabled."
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins-help ()
|
plugins-help ()
|
||||||
{
|
{
|
||||||
about list all plugins and functions defined by bash-it
|
about 'list all plugins and functions defined by bash-it'
|
||||||
group lib
|
group 'lib'
|
||||||
|
|
||||||
printf '%s\n' "bash-it plugins help"
|
printf '%s\n' "bash-it plugins help"
|
||||||
printf '\n'
|
printf '\n'
|
||||||
|
|
@ -112,8 +143,8 @@ plugins-help ()
|
||||||
|
|
||||||
all_groups ()
|
all_groups ()
|
||||||
{
|
{
|
||||||
about displays all unique metadata groups
|
about 'displays all unique metadata groups'
|
||||||
group lib
|
group 'lib'
|
||||||
|
|
||||||
typeset func
|
typeset func
|
||||||
typeset file=$(mktemp /tmp/composure.XXXX)
|
typeset file=$(mktemp /tmp/composure.XXXX)
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,26 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin miscellaneous tools
|
about-plugin 'miscellaneous tools'
|
||||||
|
|
||||||
ips ()
|
ips ()
|
||||||
{
|
{
|
||||||
about display all ip addresses for this host
|
about 'display all ip addresses for this host'
|
||||||
group base
|
group 'base'
|
||||||
ifconfig | grep "inet " | awk '{ print $2 }'
|
ifconfig | grep "inet " | awk '{ print $2 }'
|
||||||
}
|
}
|
||||||
|
|
||||||
down4me ()
|
down4me ()
|
||||||
{
|
{
|
||||||
about checks whether a website is down for you, or everybody
|
about 'checks whether a website is down for you, or everybody'
|
||||||
param 1: website url
|
param '1: website url'
|
||||||
example '$ down4me http://www.google.com'
|
example '$ down4me http://www.google.com'
|
||||||
group base
|
group 'base'
|
||||||
curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g'
|
curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g'
|
||||||
}
|
}
|
||||||
|
|
||||||
myip ()
|
myip ()
|
||||||
{
|
{
|
||||||
about displays your ip address, as seen by the Internet
|
about 'displays your ip address, as seen by the Internet'
|
||||||
group base
|
group 'base'
|
||||||
res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
|
res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
|
||||||
echo -e "Your public IP is: ${echo_bold_green} $res ${echo_normal}"
|
echo -e "Your public IP is: ${echo_bold_green} $res ${echo_normal}"
|
||||||
}
|
}
|
||||||
|
|
@ -28,10 +28,10 @@ myip ()
|
||||||
|
|
||||||
pickfrom ()
|
pickfrom ()
|
||||||
{
|
{
|
||||||
about picks random line from file
|
about 'picks random line from file'
|
||||||
param 1: filename
|
param '1: filename'
|
||||||
example '$ pickfrom /usr/share/dict/words'
|
example '$ pickfrom /usr/share/dict/words'
|
||||||
group base
|
group 'base'
|
||||||
local file=$1
|
local file=$1
|
||||||
[ -z "$file" ] && reference $FUNCNAME && return
|
[ -z "$file" ] && reference $FUNCNAME && return
|
||||||
length=$(cat $file | wc -l)
|
length=$(cat $file | wc -l)
|
||||||
|
|
@ -41,12 +41,12 @@ pickfrom ()
|
||||||
|
|
||||||
pass ()
|
pass ()
|
||||||
{
|
{
|
||||||
about generates random password from dictionary words
|
about 'generates random password from dictionary words'
|
||||||
param optional integer length
|
param 'optional integer length'
|
||||||
param if unset, defaults to 4
|
param 'if unset, defaults to 4'
|
||||||
example '$ pass'
|
example '$ pass'
|
||||||
example '$ pass 6'
|
example '$ pass 6'
|
||||||
group base
|
group 'base'
|
||||||
local i pass length=${1:-4}
|
local i pass length=${1:-4}
|
||||||
pass=$(echo $(for i in $(eval echo "{1..$length}"); do pickfrom /usr/share/dict/words; done))
|
pass=$(echo $(for i in $(eval echo "{1..$length}"); do pickfrom /usr/share/dict/words; done))
|
||||||
echo "With spaces (easier to memorize): $pass"
|
echo "With spaces (easier to memorize): $pass"
|
||||||
|
|
@ -55,10 +55,10 @@ pass ()
|
||||||
|
|
||||||
pmdown ()
|
pmdown ()
|
||||||
{
|
{
|
||||||
about preview markdown file in a browser
|
about 'preview markdown file in a browser'
|
||||||
param 1: markdown file
|
param '1: markdown file'
|
||||||
example '$ pmdown README.md'
|
example '$ pmdown README.md'
|
||||||
group base
|
group 'base'
|
||||||
if command -v markdown &>/dev/null
|
if command -v markdown &>/dev/null
|
||||||
then
|
then
|
||||||
markdown $1 | browser
|
markdown $1 | browser
|
||||||
|
|
@ -69,62 +69,62 @@ pmdown ()
|
||||||
|
|
||||||
mkcd ()
|
mkcd ()
|
||||||
{
|
{
|
||||||
about make a directory and cd into it
|
about 'make a directory and cd into it'
|
||||||
param path to create
|
param 'path to create'
|
||||||
example '$ mkcd foo'
|
example '$ mkcd foo'
|
||||||
example '$ mkcd /tmp/img/photos/large'
|
example '$ mkcd /tmp/img/photos/large'
|
||||||
group base
|
group 'base'
|
||||||
mkdir -p "$*"
|
mkdir -p "$*"
|
||||||
cd "$*"
|
cd "$*"
|
||||||
}
|
}
|
||||||
|
|
||||||
lsgrep ()
|
lsgrep ()
|
||||||
{
|
{
|
||||||
about search through directory contents with grep
|
about 'search through directory contents with grep'
|
||||||
group base
|
group 'base'
|
||||||
ls | grep "$*"
|
ls | grep "$*"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pman ()
|
pman ()
|
||||||
{
|
{
|
||||||
about view man documentation in Preview
|
about 'view man documentation in Preview'
|
||||||
param 1: man page to view
|
param '1: man page to view'
|
||||||
example '$ pman bash'
|
example '$ pman bash'
|
||||||
group base
|
group 'base'
|
||||||
man -t "${1}" | open -f -a $PREVIEW
|
man -t "${1}" | open -f -a $PREVIEW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pcurl ()
|
pcurl ()
|
||||||
{
|
{
|
||||||
about download file and Preview it
|
about 'download file and Preview it'
|
||||||
param 1: download URL
|
param '1: download URL'
|
||||||
example '$ pcurl http://www.irs.gov/pub/irs-pdf/fw4.pdf'
|
example '$ pcurl http://www.irs.gov/pub/irs-pdf/fw4.pdf'
|
||||||
group base
|
group 'base'
|
||||||
curl "${1}" | open -f -a $PREVIEW
|
curl "${1}" | open -f -a $PREVIEW
|
||||||
}
|
}
|
||||||
|
|
||||||
pri ()
|
pri ()
|
||||||
{
|
{
|
||||||
about display information about Ruby classes, modules, or methods, in Preview
|
about 'display information about Ruby classes, modules, or methods, in Preview'
|
||||||
param 1: Ruby method, module, or class
|
param '1: Ruby method, module, or class'
|
||||||
example '$ pri Array'
|
example '$ pri Array'
|
||||||
group base
|
group 'base'
|
||||||
ri -T "${1}" | open -f -a $PREVIEW
|
ri -T "${1}" | open -f -a $PREVIEW
|
||||||
}
|
}
|
||||||
|
|
||||||
quiet ()
|
quiet ()
|
||||||
{
|
{
|
||||||
about 'what *does* this do?'
|
about 'what *does* this do?'
|
||||||
group base
|
group 'base'
|
||||||
$* &> /dev/null &
|
$* &> /dev/null &
|
||||||
}
|
}
|
||||||
|
|
||||||
banish-cookies ()
|
banish-cookies ()
|
||||||
{
|
{
|
||||||
about redirect .adobe and .macromedia files to /dev/null
|
about 'redirect .adobe and .macromedia files to /dev/null'
|
||||||
group base
|
group 'base'
|
||||||
rm -r ~/.macromedia ~/.adobe
|
rm -r ~/.macromedia ~/.adobe
|
||||||
ln -s /dev/null ~/.adobe
|
ln -s /dev/null ~/.adobe
|
||||||
ln -s /dev/null ~/.macromedia
|
ln -s /dev/null ~/.macromedia
|
||||||
|
|
@ -132,9 +132,9 @@ banish-cookies ()
|
||||||
|
|
||||||
usage ()
|
usage ()
|
||||||
{
|
{
|
||||||
about disk usage per directory, in Mac OS X and Linux
|
about 'disk usage per directory, in Mac OS X and Linux'
|
||||||
param 1: directory name
|
param '1: directory name'
|
||||||
group base
|
group 'base'
|
||||||
if [ $(uname) = "Darwin" ]; then
|
if [ $(uname) = "Darwin" ]; then
|
||||||
if [ -n $1 ]; then
|
if [ -n $1 ]; then
|
||||||
du -hd $1
|
du -hd $1
|
||||||
|
|
@ -153,10 +153,10 @@ usage ()
|
||||||
|
|
||||||
t ()
|
t ()
|
||||||
{
|
{
|
||||||
about one thing todo
|
about 'one thing todo'
|
||||||
param if not set, display todo item
|
param 'if not set, display todo item'
|
||||||
param 1: todo text
|
param '1: todo text'
|
||||||
group base
|
group 'base'
|
||||||
if [[ "$*" == "" ]] ; then
|
if [[ "$*" == "" ]] ; then
|
||||||
cat ~/.t
|
cat ~/.t
|
||||||
else
|
else
|
||||||
|
|
@ -166,19 +166,19 @@ t ()
|
||||||
|
|
||||||
command_exists ()
|
command_exists ()
|
||||||
{
|
{
|
||||||
about checks for existence of a command
|
about 'checks for existence of a command'
|
||||||
param 1: command to check
|
param '1: command to check'
|
||||||
example '$ command_exists ls && echo exists'
|
example '$ command_exists ls && echo exists'
|
||||||
group base
|
group 'base'
|
||||||
type "$1" &> /dev/null ;
|
type "$1" &> /dev/null ;
|
||||||
}
|
}
|
||||||
|
|
||||||
# useful for administrators and configs
|
# useful for administrators and configs
|
||||||
buf ()
|
buf ()
|
||||||
{
|
{
|
||||||
about back up file with timestamp
|
about 'back up file with timestamp'
|
||||||
param filename
|
param 'filename'
|
||||||
group base
|
group 'base'
|
||||||
local filename=$1
|
local filename=$1
|
||||||
local filetime=$(date +%Y%m%d_%H%M%S)
|
local filetime=$(date +%Y%m%d_%H%M%S)
|
||||||
cp ${filename} ${filename}_${filetime}
|
cp ${filename} ${filename}_${filetime}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin 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%)'
|
||||||
group battery
|
group 'battery'
|
||||||
|
|
||||||
if command_exists acpi;
|
if command_exists acpi;
|
||||||
then
|
then
|
||||||
|
|
@ -69,8 +69,8 @@ battery_percentage(){
|
||||||
}
|
}
|
||||||
|
|
||||||
battery_charge(){
|
battery_charge(){
|
||||||
about graphical display of your battery charge
|
about 'graphical display of your battery charge'
|
||||||
group battery
|
group 'battery'
|
||||||
|
|
||||||
# Full char
|
# Full char
|
||||||
local F_C='▸'
|
local F_C='▸'
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ cite about-plugin
|
||||||
about-plugin 'render commandline output in your browser'
|
about-plugin 'render commandline output in your browser'
|
||||||
|
|
||||||
function browser() {
|
function browser() {
|
||||||
about pipe html to a browser
|
about 'pipe html to a browser'
|
||||||
example '$ echo "<h1>hi mom!</h1>" | browser'
|
example '$ echo "<h1>hi mom!</h1>" | browser'
|
||||||
example '$ ron -5 man/rip.5.ron | browser'
|
example '$ ron -5 man/rip.5.ron | browser'
|
||||||
group browser
|
group 'browser'
|
||||||
|
|
||||||
if [ -t 0 ]; then
|
if [ -t 0 ]; then
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
|
|
@ -27,7 +27,7 @@ function browser() {
|
||||||
function wmate() {
|
function wmate() {
|
||||||
about 'pipe hot spicy interwebs into textmate and cleanup!'
|
about 'pipe hot spicy interwebs into textmate and cleanup!'
|
||||||
example '$ wmate google.com'
|
example '$ wmate google.com'
|
||||||
group browser
|
group 'browser'
|
||||||
|
|
||||||
if [ -t 0 ]; then
|
if [ -t 0 ]; then
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
|
|
@ -64,7 +64,7 @@ EOT`
|
||||||
function raw() {
|
function raw() {
|
||||||
about 'write wget into a temp file and pump it into your browser'
|
about 'write wget into a temp file and pump it into your browser'
|
||||||
example '$ raw google.com'
|
example '$ raw google.com'
|
||||||
group browser
|
group 'browser'
|
||||||
|
|
||||||
if [ -t 0 ]; then
|
if [ -t 0 ]; then
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
# Jump to location by number.
|
# Jump to location by number.
|
||||||
|
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin directory stack navigation
|
about-plugin 'directory stack navigation'
|
||||||
|
|
||||||
# Show directory stack
|
# Show directory stack
|
||||||
alias d="dirs -v -l"
|
alias d="dirs -v -l"
|
||||||
|
|
@ -32,8 +32,8 @@ alias pu="pushd"
|
||||||
alias po="popd"
|
alias po="popd"
|
||||||
|
|
||||||
function dirs-help() {
|
function dirs-help() {
|
||||||
about directory navigation alias usage
|
about 'directory navigation alias usage'
|
||||||
group dirs
|
group 'dirs'
|
||||||
|
|
||||||
echo "Directory Navigation Alias Usage"
|
echo "Directory Navigation Alias Usage"
|
||||||
echo
|
echo
|
||||||
|
|
@ -68,17 +68,17 @@ 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
|
about 'goes to destination dir'
|
||||||
param 1: directory
|
param '1: directory'
|
||||||
example '$ G ..'
|
example '$ G ..'
|
||||||
group dirs
|
group 'dirs'
|
||||||
|
|
||||||
cd ${1:-$(pwd)} ;
|
cd ${1:-$(pwd)} ;
|
||||||
}
|
}
|
||||||
|
|
||||||
S () { # SAVE a BOOKMARK
|
S () { # SAVE a BOOKMARK
|
||||||
about save a bookmark
|
about 'save a bookmark'
|
||||||
group dirs
|
group 'dirs'
|
||||||
|
|
||||||
sed "/$@/d" ~/.dirs > ~/.dirs1;
|
sed "/$@/d" ~/.dirs > ~/.dirs1;
|
||||||
\mv ~/.dirs1 ~/.dirs;
|
\mv ~/.dirs1 ~/.dirs;
|
||||||
|
|
@ -87,8 +87,8 @@ S () { # SAVE a BOOKMARK
|
||||||
}
|
}
|
||||||
|
|
||||||
R () { # remove a BOOKMARK
|
R () { # remove a BOOKMARK
|
||||||
about remove a bookmark
|
about 'remove a bookmark'
|
||||||
group dirs
|
group 'dirs'
|
||||||
|
|
||||||
sed "/$@/d" ~/.dirs > ~/.dirs1;
|
sed "/$@/d" ~/.dirs > ~/.dirs1;
|
||||||
\mv ~/.dirs1 ~/.dirs;
|
\mv ~/.dirs1 ~/.dirs;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin one command to extract them all...
|
about-plugin 'one command to extract them all...'
|
||||||
extract () {
|
extract () {
|
||||||
if [ $# -ne 1 ]
|
if [ $# -ne 1 ]
|
||||||
then
|
then
|
||||||
|
|
|
||||||
|
|
@ -585,7 +585,7 @@ fasd --init env
|
||||||
|
|
||||||
case $- in
|
case $- in
|
||||||
*i*) cite about-plugin
|
*i*) cite about-plugin
|
||||||
about-plugin navigate 'frecently' used files and directories
|
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
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin git helper functions
|
about-plugin 'git helper functions'
|
||||||
|
|
||||||
function git_remote {
|
function git_remote {
|
||||||
about 'adds remote $GIT_HOSTING:$1 to current repo'
|
about 'adds remote $GIT_HOSTING:$1 to current repo'
|
||||||
group git
|
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
|
about 'push into origin refs/heads/master'
|
||||||
group git
|
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
|
||||||
|
|
@ -19,23 +19,23 @@ function git_first_push {
|
||||||
|
|
||||||
function git_remove_missing_files() {
|
function git_remove_missing_files() {
|
||||||
about "git rm's missing files"
|
about "git rm's missing files"
|
||||||
group git
|
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
|
about 'adds file or path to git exclude file'
|
||||||
param 1: file or path fragment to ignore
|
param '1: file or path fragment to ignore'
|
||||||
group git
|
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
|
about 'overview for your git repo'
|
||||||
group git
|
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
|
||||||
|
|
@ -71,8 +71,8 @@ function git_info() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function git_stats {
|
function git_stats {
|
||||||
about display stats per author
|
about 'display stats per author'
|
||||||
group git
|
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
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin hg helper functions
|
about-plugin 'hg helper functions'
|
||||||
|
|
||||||
hg_dirty() {
|
hg_dirty() {
|
||||||
about displays dirty status of hg repository
|
about 'displays dirty status of hg repository'
|
||||||
group hg
|
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 "!" }' \
|
||||||
|
|
@ -12,14 +12,14 @@ hg_dirty() {
|
||||||
|
|
||||||
hg_in_repo() {
|
hg_in_repo() {
|
||||||
about 'determine if pwd is an hg repo'
|
about 'determine if pwd is an hg repo'
|
||||||
group hg
|
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
|
about 'display current hg branch'
|
||||||
group hg
|
group 'hg'
|
||||||
|
|
||||||
hg branch 2> /dev/null
|
hg branch 2> /dev/null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,21 @@
|
||||||
# The install directory is hard-coded. TODO: allow the directory to be specified on the command line.
|
# The install directory is hard-coded. TODO: allow the directory to be specified on the command line.
|
||||||
|
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin download jquery files into current project
|
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'
|
about 'download rails.js into public/javascripts'
|
||||||
group javascript
|
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'
|
about 'download jquery.js into public/javascripts'
|
||||||
group javascripts
|
group 'javascripts'
|
||||||
|
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]
|
||||||
then
|
then
|
||||||
|
|
@ -28,7 +28,7 @@ function jquery_install {
|
||||||
|
|
||||||
function jquery_ui_install {
|
function jquery_ui_install {
|
||||||
about 'download jquery_us.js into public/javascripts'
|
about 'download jquery_us.js into public/javascripts'
|
||||||
group javascripts
|
group 'javascripts'
|
||||||
|
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]
|
||||||
then
|
then
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin manage your jekyll site
|
about-plugin 'manage your jekyll site'
|
||||||
|
|
||||||
editpost() {
|
editpost() {
|
||||||
about edit a post
|
about 'edit a post'
|
||||||
param 1: site directory
|
param '1: site directory'
|
||||||
group jekyll
|
group 'jekyll'
|
||||||
|
|
||||||
unset SITE
|
unset SITE
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]
|
||||||
|
|
@ -55,9 +55,9 @@ editpost() {
|
||||||
}
|
}
|
||||||
|
|
||||||
newpost() {
|
newpost() {
|
||||||
about create a new post
|
about 'create a new post'
|
||||||
param 1: site directory
|
param '1: site directory'
|
||||||
group jekyll
|
group 'jekyll'
|
||||||
|
|
||||||
unset SITE
|
unset SITE
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]
|
||||||
|
|
@ -266,9 +266,9 @@ newpost() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function testsite() {
|
function testsite() {
|
||||||
about launches local jekyll server
|
about 'launches local jekyll server'
|
||||||
param 1: site directory
|
param '1: site directory'
|
||||||
group jekyll
|
group 'jekyll'
|
||||||
|
|
||||||
unset SITE
|
unset SITE
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]
|
||||||
|
|
@ -298,9 +298,9 @@ function testsite() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildsite() {
|
function buildsite() {
|
||||||
about builds site
|
about 'builds site'
|
||||||
param 1: site directory
|
param '1: site directory'
|
||||||
group jekyll
|
group 'jekyll'
|
||||||
|
|
||||||
unset SITE
|
unset SITE
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]
|
||||||
|
|
@ -332,8 +332,8 @@ function buildsite() {
|
||||||
|
|
||||||
function deploysite() {
|
function deploysite() {
|
||||||
about 'rsyncs site to remote host'
|
about 'rsyncs site to remote host'
|
||||||
param 1: site directory
|
param '1: site directory'
|
||||||
group jekyll
|
group 'jekyll'
|
||||||
|
|
||||||
unset SITE
|
unset SITE
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin use mactex
|
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
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin manage your nginx service
|
about-plugin 'manage your nginx service'
|
||||||
|
|
||||||
function nginx_reload() {
|
function nginx_reload() {
|
||||||
about reload your nginx config
|
about 'reload your nginx config'
|
||||||
group nginx
|
group 'nginx'
|
||||||
|
|
||||||
FILE="${NGINX_PATH}/logs/nginx.pid"
|
FILE="${NGINX_PATH}/logs/nginx.pid"
|
||||||
if [ -e $FILE ]; then
|
if [ -e $FILE ]; then
|
||||||
|
|
@ -17,8 +17,8 @@ function nginx_reload() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function nginx_stop() {
|
function nginx_stop() {
|
||||||
about stop nginx
|
about 'stop nginx'
|
||||||
group nginx
|
group 'nginx'
|
||||||
|
|
||||||
FILE="${NGINX_PATH}/logs/nginx.pid"
|
FILE="${NGINX_PATH}/logs/nginx.pid"
|
||||||
if [ -e $FILE ]; then
|
if [ -e $FILE ]; then
|
||||||
|
|
@ -32,8 +32,8 @@ function nginx_stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function nginx_start() {
|
function nginx_start() {
|
||||||
about start nginx
|
about 'start nginx'
|
||||||
group nginx
|
group 'nginx'
|
||||||
|
|
||||||
FILE="${NGINX_PATH}/sbin/nginx"
|
FILE="${NGINX_PATH}/sbin/nginx"
|
||||||
if [ -e $FILE ]; then
|
if [ -e $FILE ]; then
|
||||||
|
|
@ -45,8 +45,8 @@ function nginx_start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function nginx_restart() {
|
function nginx_restart() {
|
||||||
about restart nginx
|
about 'restart nginx'
|
||||||
group nginx
|
group 'nginx'
|
||||||
|
|
||||||
FILE="${NGINX_PATH}/logs/nginx.pid"
|
FILE="${NGINX_PATH}/logs/nginx.pid"
|
||||||
if [ -e $FILE ]; then
|
if [ -e $FILE ]; then
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ nvm()
|
||||||
{
|
{
|
||||||
about 'Node Version Manager'
|
about 'Node Version Manager'
|
||||||
param '1: command, see nvm help'
|
param '1: command, see nvm help'
|
||||||
group nvm
|
group 'nvm'
|
||||||
|
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
nvm help
|
nvm help
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ about-plugin 'osx-specific functions'
|
||||||
|
|
||||||
function tab() {
|
function tab() {
|
||||||
about 'opens a new terminal tab'
|
about 'opens a new terminal tab'
|
||||||
group osx
|
group 'osx'
|
||||||
|
|
||||||
osascript 2>/dev/null <<EOF
|
osascript 2>/dev/null <<EOF
|
||||||
tell application "System Events"
|
tell application "System Events"
|
||||||
|
|
@ -22,7 +22,7 @@ function dock-switch() {
|
||||||
about 'switch dock between 2d and 3d'
|
about 'switch dock between 2d and 3d'
|
||||||
param '1: "2d" or "3d"'
|
param '1: "2d" or "3d"'
|
||||||
example '$ dock-switch 2d'
|
example '$ dock-switch 2d'
|
||||||
group osx
|
group 'osx'
|
||||||
|
|
||||||
if [ $(uname) = "Darwin" ]; then
|
if [ $(uname) = "Darwin" ]; then
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin '"alias "http" to SimpleHTTPServer'
|
about-plugin 'alias "http" to SimpleHTTPServer'
|
||||||
|
|
||||||
if [ $(uname) = "Linux" ]
|
if [ $(uname) = "Linux" ]
|
||||||
then
|
then
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ about-plugin 'adds "remove_gem" function'
|
||||||
function remove_gem {
|
function remove_gem {
|
||||||
about 'removes installed gem'
|
about 'removes installed gem'
|
||||||
param '1: installed gem name'
|
param '1: installed gem name'
|
||||||
group ruby
|
group 'ruby'
|
||||||
|
|
||||||
gem list | grep $1 | awk '{ print $1; }' | xargs sudo gem uninstall
|
gem list | grep $1 | awk '{ print $1; }' | xargs sudo gem uninstall
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ about-plugin 'virtualenvwrapper helper functions'
|
||||||
|
|
||||||
function mkvenv {
|
function mkvenv {
|
||||||
about 'create a new virtualenv for this directory'
|
about 'create a new virtualenv for this directory'
|
||||||
group virtualenv
|
group 'virtualenv'
|
||||||
|
|
||||||
cwd=`basename \`pwd\``
|
cwd=`basename \`pwd\``
|
||||||
mkvirtualenv --no-site-packages --distribute $cwd
|
mkvirtualenv --no-site-packages --distribute $cwd
|
||||||
|
|
@ -17,14 +17,14 @@ function mkvenv {
|
||||||
|
|
||||||
function mkvbranch {
|
function mkvbranch {
|
||||||
about 'create a new virtualenv for the current branch'
|
about 'create a new virtualenv for the current branch'
|
||||||
group virtualenv
|
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'
|
about 'sets workon branch'
|
||||||
group virtualenv
|
group 'virtualenv'
|
||||||
|
|
||||||
workon "$(basename `pwd`)@$(git_prompt_info)"
|
workon "$(basename `pwd`)@$(git_prompt_info)"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue