Created
February 11, 2015 18:35
-
-
Save rmetzler/9c761f4dc1874ae6aab3 to your computer and use it in GitHub Desktop.
your own command suite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dur { | |
case $1 in | |
clone|cl) | |
git clone git@bitbucket.org:nicolapaolucci/$2.git | |
;; | |
move|mv) | |
git remote add bitbucket git@bitbucket.org:nicolapaolucci/$(basename $(pwd)).git | |
git push --all bitbucket | |
;; | |
trackall|tr) | |
#track all remote branches of a project | |
for remote in $(git branch -r | grep -v master ); do git checkout --track $remote ; done | |
;; | |
key|k) | |
#track all remote branches of a project | |
ssh $2 'mkdir -p .ssh && cat >> .ssh/authorized_keys' < ~/.ssh/id_rsa.pub | |
;; | |
fun|f) | |
#list all custom bash functions defined | |
typeset -F | col 3 | grep -v _ | xargs | fold -sw 60 | |
;; | |
def|d) | |
#show definition of function $1 | |
typeset -f $2 | |
;; | |
help|h|*) | |
echo "[dur]dn shell automation tools" | |
echo "commands available:" | |
echo " [cl]one, [mv|move]" | |
echo " [f]fun lists all bash functions defined in .bashrc" | |
echo " [def] <fun> lists definition of function defined in .bashrc" | |
echo " [k]ey <host> copies ssh key to target host" | |
echo " [tr]ackall], [h]elp" | |
;; | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I stole it from the atlassian blog