-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands
executable file
·69 lines (60 loc) · 1.92 KB
/
commands
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config"
[[ " help $PLUGIN_COMMAND_PREFIX:help " == *" $1 "* ]] || [[ "$1" == "$PLUGIN_COMMAND_PREFIX:"* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_BASE_PATH/common/functions"
case "$1" in
debug)
"$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/subcommands/default" "$@"
;;
debug:off)
"$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/subcommands/off" "$@"
;;
debug:on)
"$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/subcommands/on" "$@"
;;
debug:toggle)
"$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/subcommands/toggle" "$@"
;;
help | $PLUGIN_COMMAND_PREFIX:help)
help_content_func() {
# shellcheck disable=SC2034
declare desc="return $PLUGIN_COMMAND_PREFIX plugin help content"
cat<<help_content
$PLUGIN_COMMAND_PREFIX, displays the current trace status
$PLUGIN_COMMAND_PREFIX:on, activate trace mode
$PLUGIN_COMMAND_PREFIX:off, deactivate trace mode
$PLUGIN_COMMAND_PREFIX:toggle, toggle trace mode
help_content
}
help_list_func() {
# shellcheck disable=SC2034
declare desc="return $PLUGIN_COMMAND_PREFIX plugin help content"
cat<<help_list
-----> Enabling dokku trace
help_list
}
if [[ $1 = "$PLUGIN_COMMAND_PREFIX:help" ]] ; then
echo -e "Usage: dokku $PLUGIN_COMMAND_PREFIX[:COMMAND]"
echo ''
echo "Manages dokku trace mode"
echo ''
echo 'Example:'
echo ''
echo "\$ dokku $PLUGIN_COMMAND_PREFIX:on"
help_list_func
echo ''
echo 'Additional commands:'
help_content_func | sort | column -c2 -t -s,
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
help_content_func
else
cat<<help_desc
$PLUGIN_COMMAND_PREFIX, Plugin for managing trace mode
help_desc
fi
;;
*)
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
;;
esac