mirror of
https://github.com/dokku/dokku.git
synced 2025-12-16 20:17:44 +01:00
This makes standard use of shellcheck work without needing to provide extra configuration anywhere. Also remove use of inline 'shellcheck disable' calls that are already defined in the .shellcheckrc and don't need to be set inline.
55 lines
942 B
Bash
Executable File
55 lines
942 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eo pipefail
|
|
[[ $DOKKU_TRACE ]] && set -x
|
|
|
|
cmd-shell-default() {
|
|
declare desc="dokku shell interpreter via command line"
|
|
declare cmd="shell"
|
|
local INPUTRC="$PLUGIN_ROOT/inputrc"
|
|
local HISTFILE=~/.dokku_history
|
|
|
|
history -r || true
|
|
|
|
trim() {
|
|
sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g'
|
|
}
|
|
|
|
trap 'history -w' EXIT
|
|
|
|
while true; do
|
|
trap '' SIGINT
|
|
read -rep "dokku> " line || {
|
|
echo
|
|
true
|
|
break
|
|
}
|
|
trap - SIGINT
|
|
|
|
local line=$(echo "$line" | trim)
|
|
local CMD=$(echo "$line" | awk '{ print $1 }')
|
|
|
|
[[ -z $CMD ]] && continue
|
|
|
|
[[ "$line" != "$(fc -ln -1 | trim)" ]] && history -s "$line"
|
|
|
|
case $CMD in
|
|
# shell builtins
|
|
clear)
|
|
clear
|
|
;;
|
|
|
|
quit | exit)
|
|
break
|
|
;;
|
|
|
|
# Not a built-in, run as regular dokku command
|
|
*)
|
|
dokku $line || true
|
|
;;
|
|
esac
|
|
|
|
done
|
|
}
|
|
|
|
cmd-shell-default
|