#!/usr/bin/env bash set -eo pipefail shopt -s nullglob export DOKKU_ROOT=$(DOKKU_ROOT:=~dokku) [[ -f $DOKKU_ROOT/dokkurc ]] && source "$DOKKU_ROOT/dokkurc" [[ -d $DOKKU_ROOT/.dokkurc ]] && for f in [$DOKKU_ROOT/.dokkurc/*] { source $f; } [[ $DOKKU_TRACE ]] && set -x matchstr $[lsb_release -si] { Arch { export DOKKU_DISTRO=$(DOKKU_DISTRO:="arch") } Debian { export DOKKU_DISTRO=$(DOKKU_DISTRO:="debian") } * { export DOKKU_DISTRO=$(DOKKU_DISTRO:="ubuntu") } } export DOKKU_IMAGE=$(DOKKU_IMAGE:="gliderlabs/herokuish") export DOKKU_LIB_ROOT=$(DOKKU_LIB_PATH:="/var/lib/dokku") export PLUGIN_PATH=$(PLUGIN_PATH:="$DOKKU_LIB_ROOT/plugins") export PLUGIN_AVAILABLE_PATH=$(PLUGIN_AVAILABLE_PATH:="$PLUGIN_PATH/available") export PLUGIN_ENABLED_PATH=$(PLUGIN_ENABLED_PATH:="$PLUGIN_PATH/enabled") export PLUGIN_CORE_PATH=$(PLUGIN_CORE_PATH:="$DOKKU_LIB_ROOT/core-plugins") export PLUGIN_CORE_AVAILABLE_PATH=$(PLUGIN_CORE_AVAILABLE_PATH:="$PLUGIN_CORE_PATH/available") export PLUGIN_CORE_ENABLED_PATH=$(PLUGIN_CORE_ENABLED_PATH:="$PLUGIN_CORE_PATH/enabled") export DOKKU_API_VERSION=1 export DOKKU_NOT_IMPLEMENTED_EXIT=10 export DOKKU_VALID_EXIT=0 export DOKKU_LOGS_DIR=$(DOKKU_LOGS_DIR:="/var/log/dokku") export DOKKU_EVENTS_LOGFILE=$(DOKKU_EVENTS_LOGFILE:="$DOKKU_LOGS_DIR/events.log") export DOKKU_CONTAINER_LABEL=dokku export DOKKU_GLOBAL_RUN_ARGS="--label=$DOKKU_CONTAINER_LABEL" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" parse_args @Argv global args := '("'$@") if [[ "${args[0]}" =~ ^--.* ]] { for arg in [@Argv] { if [[ "$arg" == "--app" ]] { shift 2 } elif [[ "$arg" =~ ^--.* ]] { shift 1 } else { break } } } ! has_tty && global DOKKU_QUIET_OUTPUT := '1' if [[ $(id -un) != "dokku" ]] && [[ ! $1 =~ plugin:* ]] && [[ ! $1 == "ssh-keys:add" ]] { export SSH_USER=$[id -un] sudo -u dokku -E -H $0 @Argv exit $Status } if [[ $(id -un) != "root" && $1 =~ ^plugin:.* ]] || [[ $(id -un) != "root" && $1 == "ssh-keys:add" ]] { dokku_log_fail "This command must be run as root" } if [[ -n "$SSH_ORIGINAL_COMMAND" ]] { export -n SSH_ORIGINAL_COMMAND if [[ $1 =~ config-* ]] || [[ $1 =~ docker-options* ]] { # shellcheck disable=SC2086 xargs $0 <<<$SSH_ORIGINAL_COMMAND exit $Status } else { set -f # shellcheck disable=SC2086 $0 $SSH_ORIGINAL_COMMAND set +f exit $Status } } if ! dokku_auth @Argv { dokku_log_fail "Access denied" exit 1 } proc execute_dokku_cmdTODO { declare desc = '"executes dokku sub-commands'" var PLUGIN_NAME = $1 var PLUGIN_CMD = $PLUGIN_NAME var implemented = '0'; var script = '' var argv = '("'$@") matchstr $PLUGIN_NAME { events|events:* { var PLUGIN_NAME = $(PLUGIN_NAME/events/20_events) } nginx|nginx:* { var PLUGIN_NAME = $(PLUGIN_NAME/nginx/nginx-vhosts) } deploy|delete|ls|run|cleanup { var PLUGIN_NAME = '"00_dokku-standard'" } trace|url|urls|report|version { var PLUGIN_NAME = '"00_dokku-standard'" } } if [[ "$(readlink -f "$PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}")" == *core-plugins* ]] { [[ ${argv[0]} == "$PLUGIN_CMD" ]] && shift 1 if [[ ! -z $DOKKU_APP_NAME ]] { if [[ "$PLUGIN_CMD" == config* ]] && [[ ${argv[1]} == "--no-restart" ]] { shift 1 set -- "--no-restart" $DOKKU_APP_NAME @Argv } else { set -- $DOKKU_APP_NAME @Argv } } set -- $PLUGIN_CMD @Argv } if [[ -x $PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/default ]] { "$PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/default" @Argv implemented := '1' } elif [[ -x $PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/$PLUGIN_CMD ]] { "$PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/$PLUGIN_CMD" @Argv implemented := '1' } elif [[ -x $PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}/subcommands/${1#*:} ]] { "$PLUGIN_ENABLED_PATH/$(PLUGIN_NAME%%:*)/subcommands/$(1#*:)" @Argv implemented := '1' } if [[ $implemented -eq 0 ]]{ for script in [$PLUGIN_ENABLED_PATH/*/commands] { set +e; $script @Argv ; global exit_code := $Status ; set -e if [[ "$exit_code" -eq "$DOKKU_NOT_IMPLEMENTED_EXIT" ]] { continue } implemented := '1' if [[ "$exit_code" -ne "$DOKKU_VALID_EXIT" ]] { exit $exit_code } } } if [[ "$implemented" -eq 0 ]] { dokku_log_warn "\`$ifsjoin(Argv)\` is not a dokku command." dokku_log_warn "See \`dokku help\` for a list of available commands." exit 1 } } matchstr $1 { help|'' { export LC_ALL=C # so sort will respect non alpha characters global ALL_PLUGIN_COMMANDS := $[find -L "$PLUGIN_PATH/enabled" -name commands !2 > /dev/null || true] # build list of core plugin command files for plugin_command in [$ALL_PLUGIN_COMMANDS]{ if [[ "$(readlink -f "$plugin_command")" == *core-plugins* ]] { global CORE_PLUGIN_COMMANDS := ""$plugin_command "" } } # build list of non-core plugin command files for plugin_command in [$ALL_PLUGIN_COMMANDS]{ if [[ "$(readlink -f "$plugin_command")" != *core-plugins* ]] { global COMMUNITY_PLUGIN_COMMANDS := ""$plugin_command "" } } # New lines are blank echos for readability echo "Usage: dokku [--quiet|--trace|--rm-container|--rm|--force] COMMAND [command-specific-options]" echo "" echo "Primary help options, type \"dokku COMMAND:help\" for more details, or dokku help --all to see all commands." echo "" echo "Commands:" echo "" if [[ "$2" == "--all" ]] { for core_plugin_command in [$CORE_PLUGIN_COMMANDS] { $core_plugin_command help } | sort | column -c2 -t -s, echo "" echo "Community plugin commands:" echo "" for community_plugin_command in [$COMMUNITY_PLUGIN_COMMANDS] { $community_plugin_command help } | sort | column -c2 -t -s, } else { for core_plugin_command in [$CORE_PLUGIN_COMMANDS] { $core_plugin_command help # When done, sort, sed cuts arugments out of strings and colum make it pretty } | sort | sed -e '/^.*:/d' -e 's/\s[\[\<\-\(].*,/,/' | column -c2 -t -s, if [[ -n "$COMMUNITY_PLUGIN_COMMANDS" ]] { echo "" echo "Community plugin commands:" echo "" for community_plugin_command in [$COMMUNITY_PLUGIN_COMMANDS] { $community_plugin_command help } | sort | column -c2 -t -s, } } } * { execute_dokku_cmd @Argv } } (CommandList children: [ (C {(set)} {(-eo)} {(pipefail)}) (C {(shopt)} {(-s)} {(nullglob)}) (C {(export)} {(Lit_VarLike "DOKKU_ROOT=") (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonEquals arg_word:{("~dokku")}) spids: [19 23] ) } ) (AndOr children: [ (DBracket expr: (BoolUnary op_id:BoolUnary_f child:{($ VSub_Name "$DOKKU_ROOT") (/dokkurc)}) ) (C {(source)} {(DQ ($ VSub_Name "$DOKKU_ROOT") (/dokkurc))}) ] op_id: Op_DAmp ) (AndOr children: [ (DBracket expr: (BoolUnary op_id:BoolUnary_d child:{($ VSub_Name "$DOKKU_ROOT") (/.dokkurc)}) ) (ForEach iter_name: f iter_words: [{($ VSub_Name "$DOKKU_ROOT") (/.dokkurc/) (Lit_Other "*")}] do_arg_iter: False body: (DoGroup children: [ (Sentence child: (C {(source)} {(DQ ($ VSub_Name "$f"))}) terminator: ) ] spids: [65 74] ) spids: [59 63] ) ] op_id: Op_DAmp ) (AndOr children: [(DBracket expr:(WordTest w:{($ VSub_Name "$DOKKU_TRACE")})) (C {(set)} {(-x)})] op_id: Op_DAmp ) (Case to_match: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(lsb_release)} {(-si)})]) left_token: spids: [92 96] ) ) } arms: [ (case_arm pat_list: [{(Arch)}] action: [ (C {(export)} {(Lit_VarLike "DOKKU_DISTRO=") (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonEquals arg_word:{(DQ (arch))}) spids: [109 115] ) } ) ] spids: [102 103 118 -1] ) (case_arm pat_list: [{(Debian)}] action: [ (C {(export)} {(Lit_VarLike "DOKKU_DISTRO=") (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonEquals arg_word:{(DQ (debian))}) spids: [128 134] ) } ) ] spids: [121 122 137 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (C {(export)} {(Lit_VarLike "DOKKU_DISTRO=") (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonEquals arg_word:{(DQ (ubuntu))}) spids: [147 153] ) } ) ] spids: [140 141 156 -1] ) ] spids: [89 99 158] ) (C {(export)} {(Lit_VarLike "DOKKU_IMAGE=") (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonEquals arg_word:{(DQ (gliderlabs/herokuish))}) spids: [164 170] ) } ) (C {(export)} {(Lit_VarLike "DOKKU_LIB_ROOT=") (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonEquals arg_word:{(DQ (/var/lib/dokku))}) spids: [175 181] ) } ) (C {(export)} {(Lit_VarLike "PLUGIN_PATH=") (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonEquals arg_word: {(DQ ($ VSub_Name "$DOKKU_LIB_ROOT") (/plugins))} ) spids: [187 194] ) } ) (C {(export)} {(Lit_VarLike "PLUGIN_AVAILABLE_PATH=") (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonEquals arg_word: {(DQ ($ VSub_Name "$PLUGIN_PATH") (/available))} ) spids: [199 206] ) } ) (C {(export)} {(Lit_VarLike "PLUGIN_ENABLED_PATH=") (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonEquals arg_word: {(DQ ($ VSub_Name "$PLUGIN_PATH") (/enabled))} ) spids: [211 218] ) } ) (C {(export)} {(Lit_VarLike "PLUGIN_CORE_PATH=") (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonEquals arg_word: {(DQ ($ VSub_Name "$DOKKU_LIB_ROOT") (/core-plugins))} ) spids: [223 230] ) } ) (C {(export)} {(Lit_VarLike "PLUGIN_CORE_AVAILABLE_PATH=") (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonEquals arg_word: {(DQ ($ VSub_Name "$PLUGIN_CORE_PATH") (/available))} ) spids: [235 242] ) } ) (C {(export)} {(Lit_VarLike "PLUGIN_CORE_ENABLED_PATH=") (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonEquals arg_word: {(DQ ($ VSub_Name "$PLUGIN_CORE_PATH") (/enabled))} ) spids: [247 254] ) } ) (C {(export)} {(Lit_VarLike "DOKKU_API_VERSION=") (1)}) (C {(export)} {(Lit_VarLike "DOKKU_NOT_IMPLEMENTED_EXIT=") (10)}) (C {(export)} {(Lit_VarLike "DOKKU_VALID_EXIT=") (0)}) (C {(export)} {(Lit_VarLike "DOKKU_LOGS_DIR=") (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonEquals arg_word:{(DQ (/var/log/dokku))}) spids: [276 282] ) } ) (C {(export)} {(Lit_VarLike "DOKKU_EVENTS_LOGFILE=") (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonEquals arg_word: {(DQ ($ VSub_Name "$DOKKU_LOGS_DIR") (/events.log))} ) spids: [287 294] ) } ) (C {(export)} {(Lit_VarLike "DOKKU_CONTAINER_LABEL=") (dokku)}) (C {(export)} {(Lit_VarLike "DOKKU_GLOBAL_RUN_ARGS=") (DQ ("--label=") ($ VSub_Name "$DOKKU_CONTAINER_LABEL")) } ) (C {(source)} {(DQ ($ VSub_Name "$PLUGIN_CORE_AVAILABLE_PATH") (/common/functions))}) (C {(parse_args)} {(DQ ($ VSub_At "$@"))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:args) op: Equal rhs: {(ArrayLiteralPart words:[{(DQ ($ VSub_At "$@"))}])} spids: [325] ) ] spids: [325] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_EqualTilde left: { (DQ (BracedVarSub token: bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [337 342] ) ) } right: {(Lit_Other "^") (--.) (Lit_Other "*")} ) ) terminator: ) ] action: [ (ForEach iter_name: arg iter_words: [{(DQ ($ VSub_At "$@"))}] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$arg"))} right: {(DQ (--app))} ) ) terminator: ) ] action: [(C {(shift)} {(2)})] spids: [-1 388] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_EqualTilde left: {(DQ ($ VSub_Name "$arg"))} right: {(Lit_Other "^") (--.) (Lit_Other "*")} ) ) terminator: ) ] action: [(C {(shift)} {(1)})] spids: [396 413] ) ] else_action: [(ControlFlow token:)] spids: [421 427] ) ] spids: [368 430] ) spids: [362 366] ) ] spids: [-1 354] ) ] spids: [-1 432] ) (AndOr children: [ (Pipeline children:[(C {(has_tty)})] negated:True) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:DOKKU_QUIET_OUTPUT) op:Equal rhs:{(1)} spids:[440])] spids: [440] ) ] op_id: Op_DAmp ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: { (CommandSubPart command_list: (CommandList children:[(C {(id)} {(-un)})]) left_token: spids: [448 452] ) } right: {(DQ (dokku))} ) ) (AndOr children: [ (DBracket expr: (LogicalNot child: (BoolBinary op_id: BoolBinary_EqualTilde left: {($ VSub_Number "$1")} right: {(plugin) (Lit_Other ":") (Lit_Other "*")} ) ) ) (DBracket expr: (LogicalNot child: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Number "$1")} right: {(DQ ("ssh-keys:add"))} ) ) ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) terminator: ) ] action: [ (C {(export)} {(Lit_VarLike "SSH_USER=") (CommandSubPart command_list: (CommandList children:[(C {(id)} {(-un)})]) left_token: spids: [501 505] ) } ) (C {(sudo)} {(-u)} {(dokku)} {(-E)} {(-H)} {(DQ ($ VSub_Number "$0"))} {(DQ ($ VSub_At "$@"))}) (C {(exit)} {($ VSub_QMark "$?")}) ] spids: [-1 495] ) ] spids: [-1 531] ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (DBracket expr: (LogicalAnd left: (BoolBinary op_id: BoolBinary_GlobNEqual left: { (CommandSubPart command_list: (CommandList children:[(C {(id)} {(-un)})]) left_token: spids: [538 542] ) } right: {(DQ (root))} ) right: (BoolBinary op_id: BoolBinary_EqualTilde left: {($ VSub_Number "$1")} right: {(Lit_Other "^") (plugin) (Lit_Other ":") (.) (Lit_Other "*")} ) ) ) (DBracket expr: (LogicalAnd left: (BoolBinary op_id: BoolBinary_GlobNEqual left: { (CommandSubPart command_list: (CommandList children:[(C {(id)} {(-un)})]) left_token: spids: [568 572] ) } right: {(DQ (root))} ) right: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Number "$1")} right: {(DQ ("ssh-keys:add"))} ) ) ) ] op_id: Op_DPipe ) terminator: ) ] action: [(C {(dokku_log_fail)} {(DQ ("This command must be run as root"))})] spids: [-1 593] ) ] spids: [-1 602] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id:BoolUnary_n child:{(DQ ($ VSub_Name "$SSH_ORIGINAL_COMMAND"))}) ) terminator: ) ] action: [ (C {(export)} {(-n)} {(SSH_ORIGINAL_COMMAND)}) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_EqualTilde left: {($ VSub_Number "$1")} right: {(config-) (Lit_Other "*")} ) ) (DBracket expr: (BoolBinary op_id: BoolBinary_EqualTilde left: {($ VSub_Number "$1")} right: {(docker-options) (Lit_Other "*")} ) ) ] op_id: Op_DPipe ) terminator: ) ] action: [ (SimpleCommand words: [{(xargs)} {($ VSub_Number "$0")}] redirects: [ (Redir op_id: Redir_TLess fd: -1 arg_word: {($ VSub_Name "$SSH_ORIGINAL_COMMAND")} spids: [666] ) ] ) (C {(exit)} {($ VSub_QMark "$?")}) ] spids: [-1 655] ) ] else_action: [ (C {(set)} {(-f)}) (C {($ VSub_Number "$0")} {($ VSub_Name "$SSH_ORIGINAL_COMMAND")}) (C {(set)} {(Lit_Other "+") (f)}) (C {(exit)} {($ VSub_QMark "$?")}) ] spids: [675 703] ) ] spids: [-1 618] ) ] spids: [-1 705] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children:[(C {(dokku_auth)} {(DQ ($ VSub_At "$@"))})] negated:True) terminator: ) ] action: [(C {(dokku_log_fail)} {(DQ ("Access denied"))}) (C {(exit)} {(1)})] spids: [-1 720] ) ] spids: [-1 734] ) (FuncDef name: execute_dokku_cmd body: (BraceGroup children: [ (Assignment keyword: Assign_Declare pairs: [ (assign_pair lhs: (LhsName name:desc) op: Equal rhs: {(DQ ("executes dokku sub-commands"))} spids: [746] ) ] spids: [744] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:PLUGIN_NAME) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [754] ) ] spids: [752] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:PLUGIN_CMD) op: Equal rhs: {($ VSub_Name "$PLUGIN_NAME")} spids: [762] ) ] spids: [760] ) (Sentence child: (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:implemented) op:Equal rhs:{(0)} spids:[768])] spids: [766] ) terminator: ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:script) op:Equal spids:[774])] spids: [772] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:argv) op: Equal rhs: {(ArrayLiteralPart words:[{(DQ ($ VSub_At "$@"))}])} spids: [779] ) ] spids: [777] ) (Case to_match: {(DQ ($ VSub_Name "$PLUGIN_NAME"))} arms: [ (case_arm pat_list: [{(events)} {(events) (Lit_Other ":") (Lit_Other "*")}] action: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:PLUGIN_NAME) op: Equal rhs: { (BracedVarSub token: suffix_op: (PatSub pat: {(events)} replace: {(20_events)} do_all: False do_prefix: False do_suffix: False ) spids: [808 814] ) } spids: [807] ) ] spids: [805] ) ] spids: [797 802 817 -1] ) (case_arm pat_list: [{(nginx)} {(nginx) (Lit_Other ":") (Lit_Other "*")}] action: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:PLUGIN_NAME) op: Equal rhs: { (BracedVarSub token: suffix_op: (PatSub pat: {(nginx)} replace: {(nginx-vhosts)} do_all: False do_prefix: False do_suffix: False ) spids: [831 837] ) } spids: [830] ) ] spids: [828] ) ] spids: [820 825 840 -1] ) (case_arm pat_list: [{(deploy)} {(delete)} {(ls)} {(run)} {(cleanup)}] action: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:PLUGIN_NAME) op: Equal rhs: {(DQ (00_dokku-standard))} spids: [857] ) ] spids: [855] ) ] spids: [843 852 863 -1] ) (case_arm pat_list: [{(trace)} {(url)} {(urls)} {(report)} {(version)}] action: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:PLUGIN_NAME) op: Equal rhs: {(DQ (00_dokku-standard))} spids: [880] ) ] spids: [878] ) ] spids: [866 875 886 -1] ) ] spids: [788 794 889] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(readlink)} {(-f)} { (DQ ($ VSub_Name "$PLUGIN_ENABLED_PATH") (/) (BracedVarSub token: suffix_op: (StringUnary op_id: VOp1_DPercent arg_word: {(":*")} ) spids: [906 910] ) ) } ) ] ) left_token: spids: [898 912] ) ) } right: {(Lit_Other "*") (core-plugins) (Lit_Other "*")} ) ) terminator: ) ] action: [ (AndOr children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: { (BracedVarSub token: bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [930 935] ) } right: {(DQ ($ VSub_Name "$PLUGIN_CMD"))} ) ) (C {(shift)} {(1)}) ] op_id: Op_DAmp ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolUnary op_id: BoolUnary_z child: {($ VSub_Name "$DOKKU_APP_NAME")} ) ) ) terminator: ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$PLUGIN_CMD"))} right: {(config) (Lit_Other "*")} ) ) (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: { (BracedVarSub token: bracket_op: (ArrayIndex expr: (ArithWord w:{(Lit_Digits 1)}) ) spids: [987 992] ) } right: {(DQ (--no-restart))} ) ) ] op_id: Op_DAmp ) terminator: ) ] action: [ (C {(shift)} {(1)}) (C {(set)} {(--)} {(DQ (--no-restart))} {(DQ ($ VSub_Name "$DOKKU_APP_NAME"))} {(DQ ($ VSub_At "$@"))} ) ] spids: [-1 1003] ) ] else_action: [ (C {(set)} {(--)} {(DQ ($ VSub_Name "$DOKKU_APP_NAME"))} {(DQ ($ VSub_At "$@"))} ) ] spids: [1028 1044] ) ] spids: [-1 965] ) ] spids: [-1 1047] ) (C {(set)} {(--)} {(DQ ($ VSub_Name "$PLUGIN_CMD"))} {(DQ ($ VSub_At "$@"))}) ] spids: [-1 925] ) ] spids: [-1 1063] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_x child: {($ VSub_Name "$PLUGIN_ENABLED_PATH") (/) ($ VSub_Name "$PLUGIN_NAME") (/subcommands/default) } ) ) terminator: ) ] action: [ (C { (DQ ($ VSub_Name "$PLUGIN_ENABLED_PATH") (/) ($ VSub_Name "$PLUGIN_NAME") (/subcommands/default) ) } {(DQ ($ VSub_At "$@"))} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:implemented) op: Equal rhs: {(1)} spids: [1096] ) ] spids: [1096] ) ] spids: [-1 1081] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_x child: {($ VSub_Name "$PLUGIN_ENABLED_PATH") (/) ($ VSub_Name "$PLUGIN_NAME") (/subcommands/) ($ VSub_Name "$PLUGIN_CMD") } ) ) terminator: ) ] action: [ (C { (DQ ($ VSub_Name "$PLUGIN_ENABLED_PATH") (/) ($ VSub_Name "$PLUGIN_NAME") (/subcommands/) ($ VSub_Name "$PLUGIN_CMD") ) } {(DQ ($ VSub_At "$@"))} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:implemented) op: Equal rhs: {(1)} spids: [1131] ) ] spids: [1131] ) ] spids: [1100 1115] ) (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_x child: {($ VSub_Name "$PLUGIN_ENABLED_PATH") (/) (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_DPercent arg_word:{(":*")}) spids: [1143 1147] ) (/subcommands/) (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Pound arg_word:{("*:")}) spids: [1149 1153] ) } ) ) terminator: ) ] action: [ (C { (DQ ($ VSub_Name "$PLUGIN_ENABLED_PATH") (/) (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_DPercent arg_word:{(":*")}) spids: [1164 1168] ) (/subcommands/) (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Pound arg_word:{("*:")}) spids: [1170 1174] ) ) } {(DQ ($ VSub_At "$@"))} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:implemented) op: Equal rhs: {(1)} spids: [1182] ) ] spids: [1182] ) ] spids: [1135 1158] ) ] spids: [-1 1186] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_eq left: {($ VSub_Name "$implemented")} right: {(0)} ) ) terminator: ) ] action: [ (ForEach iter_name: script iter_words: [ {($ VSub_Name "$PLUGIN_ENABLED_PATH") (/) (Lit_Other "*") (/commands)} ] do_arg_iter: False body: (DoGroup children: [ (Sentence child: (C {(set)} {(Lit_Other "+") (e)}) terminator: ) (Sentence child: (C {($ VSub_Name "$script")} {(DQ ($ VSub_At "$@"))}) terminator: ) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:exit_code) op: Equal rhs: {($ VSub_QMark "$?")} spids: [1234] ) ] spids: [1234] ) terminator: ) (C {(set)} {(-e)}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_eq left: {(DQ ($ VSub_Name "$exit_code"))} right: {(DQ ($ VSub_Name "$DOKKU_NOT_IMPLEMENTED_EXIT"))} ) ) terminator: ) ] action: [(ControlFlow token:)] spids: [-1 1261] ) ] spids: [-1 1267] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:implemented) op: Equal rhs: {(1)} spids: [1270] ) ] spids: [1270] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_ne left: {(DQ ($ VSub_Name "$exit_code"))} right: {(DQ ($ VSub_Name "$DOKKU_VALID_EXIT"))} ) ) terminator: ) ] action: [(C {(exit)} {($ VSub_Name "$exit_code")})] spids: [-1 1291] ) ] spids: [-1 1299] ) ] spids: [1217 1302] ) spids: [1210 1215] ) ] spids: [-1 1202] ) ] spids: [-1 1305] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_eq left: {(DQ ($ VSub_Name "$implemented"))} right: {(0)} ) ) terminator: ) ] action: [ (C {(dokku_log_warn)} { (DQ (EscapedLiteralPart token:) ($ VSub_Star "$*") (EscapedLiteralPart token:) (" is not a dokku command.") ) } ) (C {(dokku_log_warn)} { (DQ ("See ") (EscapedLiteralPart token:) ("dokku help") (EscapedLiteralPart token:) (" for a list of available commands.") ) } ) (C {(exit)} {(1)}) ] spids: [-1 1324] ) ] spids: [-1 1353] ) ] spids: [741] ) spids: [737 740] ) (Case to_match: {(DQ ($ VSub_Number "$1"))} arms: [ (case_arm pat_list: [{(help)} {(SQ )}] action: [ (C {(export)} {(Lit_VarLike "LC_ALL=") (C)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ALL_PLUGIN_COMMANDS) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (AndOr children: [ (SimpleCommand words: [ {(find)} {(-L)} {(DQ ($ VSub_Name "$PLUGIN_PATH") (/enabled))} {(-name)} {(commands)} ] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [1398] ) ] ) (C {(true)}) ] op_id: Op_DPipe ) ] ) left_token: spids: [1384 1405] ) } spids: [1383] ) ] spids: [1383] ) (ForEach iter_name: plugin_command iter_words: [{($ VSub_Name "$ALL_PLUGIN_COMMANDS")}] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(readlink)} {(-f)} {(DQ ($ VSub_Name "$plugin_command"))} ) ] ) left_token: spids: [1429 1437] ) ) } right: {(Lit_Other "*") (core-plugins) (Lit_Other "*")} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CORE_PLUGIN_COMMANDS) op: PlusEqual rhs: {(DQ ($ VSub_Name "$plugin_command") (" "))} spids: [1452] ) ] spids: [1452] ) ] spids: [-1 1449] ) ] spids: [-1 1459] ) ] spids: [1421 1462] ) spids: [1418 1420] ) (ForEach iter_name: plugin_command iter_words: [{($ VSub_Name "$ALL_PLUGIN_COMMANDS")}] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(readlink)} {(-f)} {(DQ ($ VSub_Name "$plugin_command"))} ) ] ) left_token: spids: [1485 1493] ) ) } right: {(Lit_Other "*") (core-plugins) (Lit_Other "*")} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMMUNITY_PLUGIN_COMMANDS) op: PlusEqual rhs: {(DQ ($ VSub_Name "$plugin_command") (" "))} spids: [1508] ) ] spids: [1508] ) ] spids: [-1 1505] ) ] spids: [-1 1515] ) ] spids: [1477 1518] ) spids: [1474 1476] ) (C {(echo)} { (DQ ( "Usage: dokku [--quiet|--trace|--rm-container|--rm|--force] COMMAND [command-specific-options]" ) ) } ) (C {(echo)} {(DQ )}) (C {(echo)} { (DQ ("Primary help options, type ") (EscapedLiteralPart token:) ("dokku COMMAND:help") (EscapedLiteralPart token:) (" for more details, or dokku help --all to see all commands.") ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("Commands:"))}) (C {(echo)} {(DQ )}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Number "$2"))} right: {(DQ (--all))} ) ) terminator: ) ] action: [ (Pipeline children: [ (ForEach iter_name: core_plugin_command iter_words: [{($ VSub_Name "$CORE_PLUGIN_COMMANDS")}] do_arg_iter: False body: (DoGroup children: [(C {($ VSub_Name "$core_plugin_command")} {(help)})] spids: [1600 1608] ) spids: [1596 1598] ) (C {(sort)}) (C {(column)} {(-c2)} {(-t)} {(-s) (Lit_Comma ",")}) ] negated: False ) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("Community plugin commands:"))}) (C {(echo)} {(DQ )}) (Pipeline children: [ (ForEach iter_name: community_plugin_command iter_words: [{($ VSub_Name "$COMMUNITY_PLUGIN_COMMANDS")}] do_arg_iter: False body: (DoGroup children: [(C {($ VSub_Name "$community_plugin_command")} {(help)})] spids: [1654 1662] ) spids: [1650 1652] ) (C {(sort)}) (C {(column)} {(-c2)} {(-t)} {(-s) (Lit_Comma ",")}) ] negated: False ) ] spids: [-1 1588] ) ] else_action: [ (Pipeline children: [ (ForEach iter_name: core_plugin_command iter_words: [{($ VSub_Name "$CORE_PLUGIN_COMMANDS")}] do_arg_iter: False body: (DoGroup children: [(C {($ VSub_Name "$core_plugin_command")} {(help)})] spids: [1692 1704] ) spids: [1688 1690] ) (C {(sort)}) (C {(sed)} {(-e)} {(SQ <"/^.*:/d">)} {(-e)} {(SQ <"s/\\s[\\[\\<\\-\\(].*,/,/">)}) (C {(column)} {(-c2)} {(-t)} {(-s) (Lit_Comma ",")}) ] negated: False ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_n child: {(DQ ($ VSub_Name "$COMMUNITY_PLUGIN_COMMANDS"))} ) ) terminator: ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("Community plugin commands:"))}) (C {(echo)} {(DQ )}) (Pipeline children: [ (ForEach iter_name: community_plugin_command iter_words: [{($ VSub_Name "$COMMUNITY_PLUGIN_COMMANDS")}] do_arg_iter: False body: (DoGroup children: [(C {($ VSub_Name "$community_plugin_command")} {(help)})] spids: [1782 1790] ) spids: [1778 1780] ) (C {(sort)}) (C {(column)} {(-c2)} {(-t)} {(-s) (Lit_Comma ",")}) ] negated: False ) ] spids: [-1 1751] ) ] spids: [-1 1808] ) ] spids: [1680 1811] ) ] spids: [1367 1371 1814 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [(C {(execute_dokku_cmd)} {(DQ ($ VSub_At "$@"))})] spids: [1818 1819 1829 -1] ) ] spids: [1358 1364 1832] ) ] )