dotwryn/bash/rentdynamics

80 lines
2.5 KiB
Plaintext
Raw Normal View History

#!/bin/bash
alias rdvmail='VMAIL_HOME=~/.vmail/business1 vmail';
function rnt() {
# filestructure needed:
# RD_PATH/project-name
# > /code (git clone)
# > /env (virtualenv)
deactivate >/dev/null 2>/dev/null || deactivate_node >/dev/null 2>/dev/null;
cd $RD_PATH;
local cont=0;
[ $1 ] \
&& [ -d $RD_PATH/$1 ] \
&& cd $1 >/dev/null 2>/dev/null \
|| cont=1;
if [ $cont -eq 0 ]; then
[ -f ./env/bin/activate ] \
&& source ./env/bin/activate \
|| echo No environment here, boss!;
[ -d ./code ] \
&& cd code \
|| echo No source folder here!;
fi
}
_rnt () { # autocompletion
# Set
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "$(ls $RD_PATH)" -- $cur) )
}
complete -F _rnt rnt;
function refresh_rd_db() {
psql postgres -c "DROP DATABASE rentdynamics;"
psql postgres -c "CREATE DATABASE rentdynamics with owner rd;"
psql postgres -c "DROP DATABASE rdrentplus;"
psql postgres -c "CREATE DATABASE rdrentplus with owner rd;"
}
function rntbranchcleanup() {
2019-08-20 17:06:05 +00:00
printf "\nInitializing branch cleanup...\n\n"
for dir in $(ls $RD_PATH); do
rnt $dir >/dev/null 2>/dev/null;
if [ -d .git ]; then
printf " - %s\e[1;34m %s\e[0m..." "clearing repository" "$dir";
git branch -d $(git branch | sed -E "/master|\*|epic-*/d") >/dev/null 2>/dev/null;
printf "\e[1;32m%s\e[0m\n" " DONE";
else
printf " - \e[1;34m%s\e[1;31m %s\e[0m" "$dir" "is not a git repository";
fi
rnt;
done;
printf "\n\n\e[1;36m%s\e[1;35m %s\e[0m\n\n" "RentDynamics" "repository branches all clean!";
}
function rdstatus() {
slack status edit "$1" $2 >/dev/null 2>&1;
}
alias rdclearstatus='slack status clear >/dev/null 2>&1'
2019-09-06 17:54:27 +00:00
alias rdstart='rdboost'
alias rdstart2='rdpanic'
alias rdplank='rdstatus "plank time!" :evergreen_tree:'
alias rdstop='rdstatus "not making money" :sunglasses:'
2019-09-06 17:54:27 +00:00
alias rdstop2='rdride'
alias rdmeal='rdstatus "so hungry..." :hamburger:'
alias rdturbo='rdstatus "ZOOOM" :turbo:'
alias rdsuper='rdstatus "AAAAAAAAAAAAHHHHHHHHH" :gohan:'
alias rdmeeting='rdstatus "afk" :necktie:'
alias rdbudget='rdstatus "did somebody say skee-ball??" :scales:'
alias rdcheese='rdstatus "only the most important things on my mind" :cheese_wedge:'
alias rdfoos='rdstatus "I will defeat Mike... someday..." :soccer:'
alias rdlax='rdstatus "BELAAAAAAAX" :exploding_head:'
2019-09-06 17:54:27 +00:00
alias rdpanic='rdstatus "dont panic!" :exclamation:'
alias rdboost='rdstatus "Use your heart, and boost fire!" :boost_fire:'
alias rdride='rdstatus "probably riding" :man-biking:'