-
Notifications
You must be signed in to change notification settings - Fork 0
/
de
executable file
·50 lines (42 loc) · 1.2 KB
/
de
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
WHITE_FG='\033[37m'
BLACK_FG='\033[30m';
GREEN_FG='\033[92m';
GRAY_FG='\033[97m';
YELLOW_FG='\033[93m';
WHITE_BG='\033[47m'
BLACK_BG='\033[40m';
GREEN_BG='\033[102m';
GRAY_BG='\033[107m';
NC='\033[0m'
# For custom config, copy the contents of the "else" block below
# to $custom and change to your needs.
custom=~/.config/de-config
if [ -f $custom ]; then
source $custom
else
dir=$(basename "$(pwd)")
declare -A config
case $dir in
laradock|laravel)
config=( ['container']='laradock-workspace-1' ['params']='-u laradock -w /var/www/laravel')
;;
symfony)
config=( ['container']='laradock-workspace-1' ['params']='-u laradock -w /var/www/symfony')
;;
*)
config=( ['container']='web' ['params']='')
esac
fi
command=$(printf '%q ' "$@")
wrapperCommand="source ~/.bashrc; $command"
echo -ne "docker exec "
echo -n ${config[params]} ${config[container]}' '
echo -ne "${YELLOW_FG}"
echo -ne "bash -ic \"source ~/.bashrc; "
echo -ne "${GREEN_FG}"
echo -n $command
echo -e "${YELLOW_FG}\"${NC}\n"
# Word splitting is intentional.
# shellcheck disable=SC2086
docker exec -it ${config[params]} ${config[container]} bash -ic "$wrapperCommand"