Merge pull request #2270 from guillaumewuip/better_apps_destroy

Allow apps:destroy when not in a project
This commit is contained in:
Michael Hobbs authored and GitHub committed 2016-06-26 14:23:57 -07:00
commit 80d13234f9
1 file changed
+9 -1
+9 -1
View File
@@ -33,6 +33,14 @@ client_help_msg() {
exit 20 # exit with specific status. only used in units tests for now exit 20 # exit with specific status. only used in units tests for now
} }
is_git_repo() {
git rev-parse &>/dev/null
}
has_dokku_remote() {
git remote show | grep dokku
}
if [[ -z $DOKKU_HOST ]]; then if [[ -z $DOKKU_HOST ]]; then
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
DOKKU_HOST=$(git remote -v 2>/dev/null | grep -Ei "^dokku" | head -n 1 | cut -f1 -d' ' | cut -f2 -d '@' | cut -f1 -d':' 2>/dev/null || true) DOKKU_HOST=$(git remote -v 2>/dev/null | grep -Ei "^dokku" | head -n 1 | cut -f1 -d' ' | cut -f2 -d '@' | cut -f1 -d':' 2>/dev/null || true)
@@ -81,7 +89,7 @@ if [[ ! -z $DOKKU_HOST ]]; then
fi fi
;; ;;
apps:destroy) apps:destroy)
git remote remove dokku is_git_repo && has_dokku_remote && git remote remove dokku
;; ;;
esac esac