-
Notifications
You must be signed in to change notification settings - Fork 126
/
env_posix.sh
36 lines (28 loc) · 997 Bytes
/
env_posix.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
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
PROJECT_DIR=$(realpath "$SCRIPT_DIR")
KSCRIPT_EXEC_DIR="$PROJECT_DIR/build/kscript/bin"
KSCRIPT_TEST_DIR="$PROJECT_DIR/build/tmp/test"
mkdir -p $KSCRIPT_EXEC_DIR
mkdir -p $KSCRIPT_TEST_DIR
echo "Setting up environment..."
echo "SCRIPT_DIR : $SCRIPT_DIR"
echo "PROJECT_DIR: $PROJECT_DIR"
echo "KSCRIPT_EXEC_DIR: $KSCRIPT_EXEC_DIR"
echo "KSCRIPT_TEST_DIR: $KSCRIPT_TEST_DIR"
echo
if [[ "$PATH" != *"$KSCRIPT_EXEC_DIR"* ]]; then
export PATH=$KSCRIPT_EXEC_DIR:$PATH
fi
echo "KScript path for testing: $(which kscript)"
alias cdk="cd $PROJECT_DIR"
alias switchPath='
if [[ "$PATH" != *"$KSCRIPT_EXEC_DIR"* ]]; then
export PATH="$KSCRIPT_EXEC_DIR:$PATH"
echo "Project path set."
else
export PATH=$(echo $PATH | tr ":" "\n" | grep -v "$KSCRIPT_EXEC_DIR" | grep -v "^$" | tr "\n" ":")
echo "Generic path set."
fi
'
alias help-dev="cat $SCRIPT_DIR/test/help-dev.txt"