forked from costastf/toonapilib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_aliases.sh
24 lines (21 loc) · 863 Bytes
/
setup_aliases.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
# Needs to be sourced
# Sets up alias functions for the interface while keeping backwards compatibility with the old bash type
for command in $(ls _CI/scripts/ | cut -d'.' -f1 | grep -v "^_")
do
eval "_$command() { if [ -f _CI/scripts/$command.py ]; then ./_CI/scripts/$command.py \"\$@\"; elif [ -f _CI/scripts/$command ]; then ./_CI/scripts/$command \"\$@\" ;else echo \"Command ./_CI/scripts/$command.py or ./_CI/scripts/$command not found\" ; fi }"
done
function _activate() {
EXIT_CODE=false
for path in '.venv/bin/activate' '_CI/files/.venv/bin/activate'
do
if [ -f "${path}" ]; then
. "${path}"
EXIT_CODE=true
break
fi
done
if [ "${EXIT_CODE}" = false ]; then
echo Could not find virtual environment to activate
fi
}