Created
June 30, 2020 16:52
-
-
Save annibal/736f8814343abc3ee211c501e8720f81 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/ksh | |
# | |
# @(69)$Id$ | |
# | |
# Helpful functions for your terminal | |
function git_branches() | |
{ | |
if [[ -z "$1" ]]; then | |
git_branches . | |
return 0 | |
fi | |
if [[ ! -d "$1" ]]; then | |
echo "Invalid dir specified: '${1}'" | |
return 1 | |
fi | |
# Subshell so we don't end up in a different dir than where we started. | |
( | |
cd "$1" | |
for sub in *; do | |
[[ -d "${sub}/.git" ]] || continue | |
printf "\e[32m%25s\e[0m [\e[1m%s\e[0m]\n" $sub $(cd "$sub"; git branch | grep '^\*' | cut -d' ' -f2); | |
done | |
) | |
} | |
alias git-fetch-all="echo 'Fetching all'; for i in */.git; do ( echo \$i; cd \$i/..; git fetch -vp; echo ''); done" | |
alias git-pull-all="echo 'Pulling all'; for i in */.git; do ( echo \$i; cd \$i/..; git pull; echo ''); done" | |
alias dup-all="echo 'Upping all'; for i in */docker-compose.*; do ( cd ./\$(echo \$i | sed 's/docker-compose..*//g'); echo ''; pwd; docker-compose up -d; ); done" | |
alias dstop-all="docker stop \$(docker ps -q)" | |
alias dps="docker ps --format 'table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Ports}}'" | |
alias my-commands="alias | sed -E 's/alias ([^=]*)=.*/\1/'" | |
cd ~/Documents/Repositories/unilever/ | |
wait $! | |
printf "\e[1m%25s\e[0m \e[1m%s\e[0m\n" "Repos" "Branch" | |
git_branches | |
echo -e ""; | |
printf "\e[32m%s\e[0m\n" "Available Aliases:"; | |
my-commands |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment