Merge pull request #2616 from dokku/2356-apps-report-cleanup

Replace apps subcommand with apps:list
This commit is contained in:
Jose Diaz-Gonzalez
2017-02-23 19:38:40 -07:00
committed by GitHub
7 changed files with 73 additions and 51 deletions

View File

@@ -3,10 +3,10 @@
> New as of 0.3.1
```
apps # List your apps
apps:clone <old-app> <new-app> # Clones an app
apps:create <app> # Create a new app
apps:destroy <app> # Permanently destroy an app
apps:list # List your apps
apps:rename <old-app> <new-app> # Rename an app
apps:report [<app>] [<flag>] # Display report about an app
```
@@ -15,10 +15,12 @@ apps:report [<app>] [<flag>] # Display report about an app
### Listing Applications
You can easily list all available applications using the `apps` command:
> New as of 0.8.1. Use the `apps` command for older versions.
You can easily list all available applications using the `apps:list` command:
```shell
dokku apps
dokku apps:list
```
```
@@ -30,7 +32,7 @@ python-app
Note that you can easily hide extra output from Dokku commands by using the `--quiet` flag, which makes it easier to parse on the command-line.
```shell
dokku --quiet apps
dokku --quiet apps:list
```
```
@@ -179,6 +181,7 @@ dokku apps:report node-js-app
```
You can pass flags which will output only the value of the specific information you want. For example:
```shell
dokku apps:report node-js-app --git-sha
```

View File

@@ -1,38 +1,11 @@
#!/usr/bin/env bash
[[ " help apps:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | apps:help)
help_content_func () {
declare desc="return apps plugin help content"
cat<<help_content
apps, List your apps
apps:clone <old-app> <new-app>, Clones an app
apps:create <app>, Create a new app
apps:destroy <app>, Permanently destroy an app
apps:rename <old-app> <new-app>, Rename an app
apps:report [<app>] [<flag>], Display report about an app
help_content
}
if [[ $1 = "apps:help" ]] ; then
echo -e 'Usage: dokku apps[:COMMAND]'
echo ''
echo 'List your apps.'
echo ''
echo 'Example:'
echo ''
echo '$ dokku apps'
echo '=====> My Apps'
echo 'example'
echo 'example2'
echo ''
echo 'Additional commands:'
help_content_func | sort | column -c2 -t -s,
else
help_content_func
fi
apps_help_cmd "$@"
;;
*)

51
plugins/apps/internal-functions Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
apps_help_content_func() {
declare desc="return apps plugin help content"
cat<<help_content
apps, [DEPRECATED] Alias for apps:list
apps:clone <old-app> <new-app>, Clones an app
apps:create <app>, Create a new app
apps:destroy <app>, Permanently destroy an app
apps:list, List your apps
apps:rename <old-app> <new-app>, Rename an app
apps:report [<app>] [<flag>], Display report about an app
help_content
}
apps_help_cmd() {
if [[ $1 = "apps:help" ]] ; then
echo -e 'Usage: dokku apps[:COMMAND]'
echo ''
echo 'Manage Dokku apps'
echo ''
echo 'Example:'
echo ''
echo '$ dokku apps'
echo '=====> My Apps'
echo 'example'
echo 'example2'
echo ''
echo 'Additional commands:'
apps_help_content_func | sort | column -c2 -t -s,
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
apps_help_content_func
else
cat<<help_desc
apps, Manage Dokku apps
help_desc
fi
}
apps_list_cmd() {
declare desc="lists all apps"
local cmd="apps"
local app
dokku_log_info2_quiet "My Apps"
for app in $(dokku_apps); do
echo "$app"
done
}

View File

@@ -1,16 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
apps_main_cmd() {
declare desc="lists all apps"
local cmd="apps"
local app
dokku_log_info2_quiet "My Apps"
for app in $(dokku_apps); do
echo "$app"
done
}
apps_main_cmd "$@"
dokku_log_warn "Deprecated: Please use apps:list"
apps_list_cmd "$@"

5
plugins/apps/subcommands/list Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
apps_list_cmd "$@"

View File

@@ -65,7 +65,7 @@ report_single_app() {
}
apps_report_cmd() {
declare desc="shows reports for an app"
declare desc="displays the app report for one or more apps"
local cmd="apps:report"
local INSTALLED_APPS=$(dokku_apps)
local APP

View File

@@ -15,7 +15,7 @@ teardown () {
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku apps | grep $TEST_APP"
run bash -c "dokku apps:list | grep $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_output $TEST_APP
@@ -36,7 +36,7 @@ teardown () {
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku apps | grep $TEST_APP"
run bash -c "dokku apps:list | grep $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_output $TEST_APP
@@ -64,7 +64,7 @@ teardown () {
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku apps | grep $TEST_APP"
run bash -c "dokku apps:list | grep $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_output ""
@@ -97,7 +97,7 @@ teardown () {
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku apps | grep $TEST_APP"
run bash -c "dokku apps:list | grep $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_success