forked from dokku/dokku-maintenance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands
executable file
·57 lines (48 loc) · 1.86 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
#!/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
$PLUGIN_COMMAND_PREFIX:on)
"$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/subcommands/on" "$@"
;;
$PLUGIN_COMMAND_PREFIX:off)
"$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/subcommands/off" "$@"
;;
$PLUGIN_COMMAND_PREFIX)
"$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/subcommands/default" "$@"
;;
$PLUGIN_COMMAND_PREFIX:custom-page)
"$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/subcommands/custom-page" "$@"
;;
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 <app>, Display the current maintenance status of app
$PLUGIN_COMMAND_PREFIX:on <app>, Put the app into maintenance mode
$PLUGIN_COMMAND_PREFIX:off <app>, Take the app out of maintenance mode
$PLUGIN_COMMAND_PREFIX:custom-page <app>, Imports a tarball from stdin; should contain at least maintenance.html
help_content
}
if [[ $1 = "$PLUGIN_COMMAND_PREFIX:help" ]] ; then
echo -e "Usage: dokku $PLUGIN_COMMAND_PREFIX[:COMMAND]"
echo ''
echo "Manage the maintenance mode of your applications."
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 application maintenance mode
help_desc
fi
;;
*)
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
;;
esac