From 6aa315f8157bc03c621bdf22c774455e66e185c6 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 19 Aug 2017 18:55:56 -0400 Subject: [PATCH] fix: properly detect empty subcommands Closes #2849 --- dokku | 2 +- tests/unit/40_core_2.bats | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dokku b/dokku index a8f4a3606..980b0e9a9 100755 --- a/dokku +++ b/dokku @@ -125,7 +125,7 @@ execute_dokku_cmd() { elif [[ -x $PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/$PLUGIN_CMD ]]; then "$PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/$PLUGIN_CMD" "$@" implemented=1 - elif [[ -x $PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}/subcommands/${1#*:} ]]; then + elif [[ -x $PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}/subcommands/${1#*:} ]] && [[ "${1#*:}" !== ":" ]]; then "$PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}/subcommands/${1#*:}" "$@" implemented=1 fi diff --git a/tests/unit/40_core_2.bats b/tests/unit/40_core_2.bats index c9f6ed581..a26d2c8b6 100644 --- a/tests/unit/40_core_2.bats +++ b/tests/unit/40_core_2.bats @@ -50,10 +50,16 @@ build_nginx_config() { echo "output: "$output echo "status: "$status assert_failure + run /bin/bash -c "dokku fakecommand 2>&1 | grep -q 'is not a dokku command'" echo "output: "$output echo "status: "$status assert_success + + run /bin/bash -c "dokku apps: 2>&1 | grep -q 'is not a dokku command'" + echo "output: "$output + echo "status: "$status + assert_success } @test "(core) urls (non-ssl)" {