-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathscript.sh
executable file
·55 lines (49 loc) · 1.08 KB
/
script.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
## Lando Script launcher
## This file is used launch lando-scripts scripts.
## ------------------------------------------------------------
# Define available scripts
declare -A LANDO_SCRIPTS=(
[ssh]='ssh.sh'
[pull-db]='pull-database.sh'
[pull-files]='pull-files.sh'
[local-config]='local-config.sh'
[push-lib]='push-libraries.sh'
)
SCRIPTPATH=$(dirname "${BASH_SOURCE[0]}");
# Display help message
function lando-scripts-help {
# List avaialable scripts
echo; echo "Usage: lando script <script name>"; echo
echo "$(tput setaf 2)Available scripts:$(tput sgr0)"
for S in "${!LANDO_SCRIPTS[@]}"; do
tput cuf 2; echo $S
done
}
# Parse arguments
while (( "$#" )); do
case "$1" in
--help)
# Display help
lando-scripts-help
shift
;;
--)
shift
break
;;
-*|--*=)
echo "Error: Unsupported flag $1" >&2
exit 1
;;
*)
SCRIPT="$1"
EXECUTE=true
shift
;;
esac
done
# Execute Lando Script
if [ "$EXECUTE" = true ] ; then
bash $SCRIPTPATH/${LANDO_SCRIPTS[$SCRIPT]}
fi