Files
dokku/plugins/trace/subcommands/default
Jose Diaz-Gonzalez 1cb586b2e7 refactor: standardize command naming
This standardization makes it somewhat easier to read stacktraces as the command names are all uniform, so it will be slightly easier to scan trace output.
2020-02-09 22:41:39 -05:00

28 lines
744 B
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cmd-trace-default() {
declare desc="enables/disables trace mode"
local cmd="trace"
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p "$DOKKU_ROOT/.dokkurc"
[[ "$2" == "on" ]] || [[ "$2" == "off" ]] || {
dokku_log_fail "Valid trace options are [on/off]"
}
dokku_log_warn "Deprecated: Please use trace:on or trace:off"
if [[ "$2" == "on" ]]; then
dokku_log_info1 "Enabling trace mode"
echo "export DOKKU_TRACE=1" >"$DOKKU_ROOT/.dokkurc/DOKKU_TRACE"
fi
if [[ "$2" == "off" ]]; then
dokku_log_info1 "Disabling trace mode"
rm -f "$DOKKU_ROOT/.dokkurc/DOKKU_TRACE"
fi
}
cmd-trace-default "$@"