forked from Accenture/adop-docker-compose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adop
executable file
·44 lines (36 loc) · 1012 Bytes
/
adop
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
#!/bin/bash -e
CMD_NAME=`basename "$0"`
# The sed expression here replaces all backslashes by forward slashes.
# This helps our Windows users, while not bothering our Unix users.
export CLI_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
export CONF_DIR="${CLI_DIR}"
export CONF_PROVIDER_DIR="${CLI_DIR}/conf/provider"
CLI_CMD_DIR="${CLI_DIR}/cmd"
usage() {
echo "usage: ${CMD_NAME} <subcommand>"
echo
echo "Available subcommands are:"
for command in $(ls $CLI_DIR/cmd)
do
printf " %-10s $(. ${CLI_CMD_DIR}/${command} cmd_desc)" "${command}"
echo
done
echo
echo "Try '${CMD_NAME} <subcommand> help' for details."
echo "HINT: Run '${CMD_NAME} compose init' to start the platform"
echo
}
main() {
if [ $# -lt 1 ]; then
usage
exit 0
fi
SUBCOMMAND="$1"; shift
if [ ! -e "${CLI_CMD_DIR}/$SUBCOMMAND" ]; then
usage
exit 1
fi
# run command
. "${CLI_CMD_DIR}/$SUBCOMMAND" "$@"
}
main "$@"