dot/.config/aliasrc/work

59 lines
1.8 KiB
Text
Executable file

# Work directories
WORK="$HOME/Projects/Work"
UTIL="$HOME/Projects/Work/utility"
PUB="$HOME/Projects/Work/publikator/"
AR="$HOME/Projects/Work/arriva_server/"
NEG="$HOME/Projects/Work/negocjator/"
SZ="$HOME/Projects/Work/szyna/"
# Workflow
alias work="cd $WORK"
alias util="cd $UTIL && make"
alias pub="cd $PUB"
alias neg="cd $NEG"
alias sz="cd $SZ"
alias ar="cd $AR"
alias activate_venv="[ -f .venv/bin/activate ] && source .venv/bin/activate"
alias display_makefile_help="[ -f Makefile ] && make"
# dynamic aliases
create_work_aliases() {
for d in $PUB/*; do
if [ -d "$d" ]; then
last_part=$(basename $d | tr "_" " " | awk '{print $NF}')
last_part=${last_part:0:1}
last_part=$(echo $last_part | tr '[:upper:]' '[:lower:]')
alias pub$last_part="cd $d && display_makefile_help && activate_venv"
fi
done
for d in $NEG/*; do
if [ -d "$d" ]; then
last_part=$(basename $d | tr "_" " " | awk '{print $NF}')
last_part=${last_part:0:1}
last_part=$(echo $last_part | tr '[:upper:]' '[:lower:]')
alias neg$last_part="cd $d && display_makefile_help && activate_venv"
fi
done
for d in $SZ/*; do
if [ -d "$d" ]; then
last_part=$(basename $d | tr "_" " " | awk '{print $NF}')
last_part=${last_part:0:2}
last_part=$(echo $last_part | tr '[:upper:]' '[:lower:]')
alias sz$last_part="cd $d && display_makefile_help && activate_venv"
fi
done
for d in $AR/*; do
if [ -d "$d" ]; then
last_part=$(basename $d | tr "_" " " | awk '{print $NF}')
last_part=${last_part:0:1}
last_part=$(echo $last_part | tr '[:upper:]' '[:lower:]')
alias ar$last_part="cd $d && display_makefile_help && activate_venv"
fi
done
}
create_work_aliases