Merge pull request #4264 from dokku/4255-client-parsing
Correct argument handling when setting the `--app` flag
This commit is contained in:
@@ -72,6 +72,9 @@ main() {
|
|||||||
skip=false
|
skip=false
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
is_flag=false
|
||||||
|
|
||||||
|
[[ "$arg" =~ ^--.* ]] && is_flag=true
|
||||||
|
|
||||||
if [[ "$arg" == "--app" ]]; then
|
if [[ "$arg" == "--app" ]]; then
|
||||||
APP=${args[$next_index]}
|
APP=${args[$next_index]}
|
||||||
@@ -82,10 +85,10 @@ main() {
|
|||||||
skip=true
|
skip=true
|
||||||
shift 2
|
shift 2
|
||||||
elif [[ "$arg" =~ ^--.* ]]; then
|
elif [[ "$arg" =~ ^--.* ]]; then
|
||||||
[[ "$cmd_set" == "true" ]] && APP_ARG="$arg" && break
|
[[ "$cmd_set" == "true" ]] && [[ "$is_flag" == "false" ]] && APP_ARG="$arg" && break
|
||||||
[[ "$arg" == "--trace" ]] && export DOKKU_TRACE=1 && set -x
|
[[ "$arg" == "--trace" ]] && export DOKKU_TRACE=1 && set -x
|
||||||
else
|
else
|
||||||
if [[ "$cmd_set" == "true" ]]; then
|
if [[ "$cmd_set" == "true" ]] && [[ "$is_flag" == "false" ]]; then
|
||||||
APP_ARG="$arg"
|
APP_ARG="$arg"
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
@@ -110,7 +113,7 @@ main() {
|
|||||||
|
|
||||||
case "$CMD" in
|
case "$CMD" in
|
||||||
apps:create)
|
apps:create)
|
||||||
if [[ -z "$APP_ARG" ]]; then
|
if [[ -z "$APP" ]] && [[ -z "$APP_ARG" ]]; then
|
||||||
APP=$(fn-random-name)
|
APP=$(fn-random-name)
|
||||||
counter=0
|
counter=0
|
||||||
while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_REMOTE_HOST" apps 2>/dev/null | grep -q "$APP"; do
|
while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_REMOTE_HOST" apps 2>/dev/null | grep -q "$APP"; do
|
||||||
@@ -123,7 +126,7 @@ main() {
|
|||||||
counter=$((counter + 1))
|
counter=$((counter + 1))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
elif [[ -z "$APP" ]]; then
|
||||||
APP="$APP_ARG"
|
APP="$APP_ARG"
|
||||||
fi
|
fi
|
||||||
if git remote add "$DOKKU_GIT_REMOTE" "dokku@$DOKKU_REMOTE_HOST:$APP"; then
|
if git remote add "$DOKKU_GIT_REMOTE" "dokku@$DOKKU_REMOTE_HOST:$APP"; then
|
||||||
|
|||||||
7
dokku
7
dokku
@@ -144,12 +144,7 @@ execute_dokku_cmd() {
|
|||||||
if [[ "$(readlink -f "$PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}")" == *core-plugins* ]]; then
|
if [[ "$(readlink -f "$PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}")" == *core-plugins* ]]; then
|
||||||
[[ ${argv[0]} == "$PLUGIN_CMD" ]] && shift 1
|
[[ ${argv[0]} == "$PLUGIN_CMD" ]] && shift 1
|
||||||
if [[ -n $DOKKU_APP_NAME ]]; then
|
if [[ -n $DOKKU_APP_NAME ]]; then
|
||||||
if [[ "$PLUGIN_CMD" == config* ]] && [[ ${argv[1]} == "--no-restart" ]]; then
|
set -- "$DOKKU_APP_NAME" "$@"
|
||||||
shift 1
|
|
||||||
set -- "--no-restart" "$DOKKU_APP_NAME" "$@"
|
|
||||||
else
|
|
||||||
set -- "$DOKKU_APP_NAME" "$@"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
set -- "$PLUGIN_CMD" "$@"
|
set -- "$PLUGIN_CMD" "$@"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ require (
|
|||||||
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 // indirect
|
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 // indirect
|
||||||
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 // indirect
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 // indirect
|
||||||
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/dokku/dokku/plugins/common => ../common
|
replace github.com/dokku/dokku/plugins/common => ../common
|
||||||
|
|||||||
@@ -4,3 +4,5 @@ github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 h1:HHUr4P/aKh4qu
|
|||||||
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27/go.mod h1:VQx0hjo2oUeQkQUET7wRwradO6f+fN5jzXgB/zROxxE=
|
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27/go.mod h1:VQx0hjo2oUeQkQUET7wRwradO6f+fN5jzXgB/zROxxE=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/dokku/dokku/plugins/apps"
|
"github.com/dokku/dokku/plugins/apps"
|
||||||
"github.com/dokku/dokku/plugins/common"
|
"github.com/dokku/dokku/plugins/common"
|
||||||
|
|
||||||
|
flag "github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// main entrypoint to all subcommands
|
// main entrypoint to all subcommands
|
||||||
@@ -64,10 +65,12 @@ func main() {
|
|||||||
err = apps.CommandRename(oldAppName, newAppName, *skipDeploy)
|
err = apps.CommandRename(oldAppName, newAppName, *skipDeploy)
|
||||||
case "report":
|
case "report":
|
||||||
args := flag.NewFlagSet("apps:report", flag.ExitOnError)
|
args := flag.NewFlagSet("apps:report", flag.ExitOnError)
|
||||||
args.Parse(os.Args[2:])
|
osArgs, infoFlag, err := common.ParseReportArgs("apps", os.Args[2:])
|
||||||
appName := args.Arg(0)
|
if err == nil {
|
||||||
infoFlag := args.Arg(1)
|
args.Parse(osArgs)
|
||||||
err = apps.CommandReport(appName, infoFlag)
|
appName := args.Arg(0)
|
||||||
|
err = apps.CommandReport(appName, infoFlag)
|
||||||
|
}
|
||||||
case "unlock":
|
case "unlock":
|
||||||
args := flag.NewFlagSet("apps:unlock", flag.ExitOnError)
|
args := flag.NewFlagSet("apps:unlock", flag.ExitOnError)
|
||||||
args.Parse(os.Args[2:])
|
args.Parse(os.Args[2:])
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/dokku/dokku/plugins/common"
|
"github.com/dokku/dokku/plugins/common"
|
||||||
)
|
)
|
||||||
@@ -197,11 +196,6 @@ func CommandRename(oldAppName string, newAppName string, skipDeploy bool) error
|
|||||||
|
|
||||||
// CommandReport displays an app report for one or more apps
|
// CommandReport displays an app report for one or more apps
|
||||||
func CommandReport(appName string, infoFlag string) error {
|
func CommandReport(appName string, infoFlag string) error {
|
||||||
if strings.HasPrefix(appName, "--") {
|
|
||||||
infoFlag = appName
|
|
||||||
appName = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(appName) == 0 {
|
if len(appName) == 0 {
|
||||||
apps, err := common.DokkuApps()
|
apps, err := common.DokkuApps()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ require (
|
|||||||
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 // indirect
|
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 // indirect
|
||||||
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3
|
||||||
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/dokku/dokku/plugins/common => ../common
|
replace github.com/dokku/dokku/plugins/common => ../common
|
||||||
|
|||||||
@@ -4,3 +4,5 @@ github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 h1:HHUr4P/aKh4qu
|
|||||||
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27/go.mod h1:VQx0hjo2oUeQkQUET7wRwradO6f+fN5jzXgB/zROxxE=
|
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27/go.mod h1:VQx0hjo2oUeQkQUET7wRwradO6f+fN5jzXgB/zROxxE=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/dokku/dokku/plugins/buildpacks"
|
"github.com/dokku/dokku/plugins/buildpacks"
|
||||||
"github.com/dokku/dokku/plugins/common"
|
"github.com/dokku/dokku/plugins/common"
|
||||||
|
|
||||||
|
flag "github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// main entrypoint to all subcommands
|
// main entrypoint to all subcommands
|
||||||
@@ -43,10 +44,12 @@ func main() {
|
|||||||
err = buildpacks.CommandRemove(appName, buildpack, *index)
|
err = buildpacks.CommandRemove(appName, buildpack, *index)
|
||||||
case "report":
|
case "report":
|
||||||
args := flag.NewFlagSet("buildpacks:report", flag.ExitOnError)
|
args := flag.NewFlagSet("buildpacks:report", flag.ExitOnError)
|
||||||
args.Parse(os.Args[2:])
|
osArgs, infoFlag, err := common.ParseReportArgs("buildpacks", os.Args[2:])
|
||||||
appName := args.Arg(0)
|
if err == nil {
|
||||||
infoFlag := args.Arg(1)
|
args.Parse(osArgs)
|
||||||
err = buildpacks.CommandReport(appName, infoFlag)
|
appName := args.Arg(0)
|
||||||
|
err = buildpacks.CommandReport(appName, infoFlag)
|
||||||
|
}
|
||||||
case "set":
|
case "set":
|
||||||
args := flag.NewFlagSet("buildpacks:set", flag.ExitOnError)
|
args := flag.NewFlagSet("buildpacks:set", flag.ExitOnError)
|
||||||
index := args.Int("index", 0, "--index: the 1-based index of the URL in the list of URLs")
|
index := args.Int("index", 0, "--index: the 1-based index of the URL in the list of URLs")
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package buildpacks
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/dokku/dokku/plugins/common"
|
"github.com/dokku/dokku/plugins/common"
|
||||||
)
|
)
|
||||||
@@ -106,11 +105,6 @@ func CommandRemove(appName string, buildpack string, index int) (err error) {
|
|||||||
|
|
||||||
// CommandReport displays a buildpacks report for one or more apps
|
// CommandReport displays a buildpacks report for one or more apps
|
||||||
func CommandReport(appName string, infoFlag string) error {
|
func CommandReport(appName string, infoFlag string) error {
|
||||||
if strings.HasPrefix(appName, "--") {
|
|
||||||
infoFlag = appName
|
|
||||||
appName = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(appName) == 0 {
|
if len(appName) == 0 {
|
||||||
apps, err := common.DokkuApps()
|
apps, err := common.DokkuApps()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -286,6 +286,27 @@ func GetenvWithDefault(key string, defaultValue string) (val string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ParseReportArgs splits out flags from non-flags for input into report commands
|
||||||
|
func ParseReportArgs(pluginName string, arguments []string) ([]string, string, error) {
|
||||||
|
osArgs := []string{}
|
||||||
|
infoFlags := []string{}
|
||||||
|
for _, argument := range arguments {
|
||||||
|
if strings.HasPrefix(argument, "--") {
|
||||||
|
infoFlags = append(infoFlags, argument)
|
||||||
|
} else {
|
||||||
|
osArgs = append(osArgs, argument)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(infoFlags) == 0 {
|
||||||
|
return osArgs, "", nil
|
||||||
|
}
|
||||||
|
if len(infoFlags) == 1 {
|
||||||
|
return osArgs, infoFlags[0], nil
|
||||||
|
}
|
||||||
|
return osArgs, "", fmt.Errorf("%s:report command allows only a single flag", pluginName)
|
||||||
|
}
|
||||||
|
|
||||||
// ReportSingleApp is an internal function that displays a report for an app
|
// ReportSingleApp is an internal function that displays a report for an app
|
||||||
func ReportSingleApp(reportType string, appName string, infoFlag string, infoFlags map[string]string, trimPrefix bool, uppercaseFirstCharacter bool) error {
|
func ReportSingleApp(reportType string, appName string, infoFlag string, infoFlags map[string]string, trimPrefix bool, uppercaseFirstCharacter bool) error {
|
||||||
flags := []string{}
|
flags := []string{}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ require (
|
|||||||
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
||||||
github.com/joho/godotenv v1.2.0
|
github.com/joho/godotenv v1.2.0
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3
|
||||||
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/dokku/dokku/plugins/common => ../common
|
replace github.com/dokku/dokku/plugins/common => ../common
|
||||||
|
|||||||
@@ -6,3 +6,5 @@ github.com/joho/godotenv v1.2.0 h1:vGTvz69FzUFp+X4/bAkb0j5BoLC+9bpqTWY8mjhA9pc=
|
|||||||
github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/dokku/dokku/plugins/common"
|
"github.com/dokku/dokku/plugins/common"
|
||||||
"github.com/dokku/dokku/plugins/config"
|
"github.com/dokku/dokku/plugins/config"
|
||||||
|
|
||||||
|
flag "github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getKeys(args []string, global bool) []string {
|
func getKeys(args []string, global bool) []string {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ require (
|
|||||||
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
|
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
|
||||||
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 // indirect
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 // indirect
|
||||||
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/dokku/dokku/plugins/common => ../common
|
replace github.com/dokku/dokku/plugins/common => ../common
|
||||||
|
|||||||
@@ -4,3 +4,5 @@ github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 h1:HHUr4P/aKh4qu
|
|||||||
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27/go.mod h1:VQx0hjo2oUeQkQUET7wRwradO6f+fN5jzXgB/zROxxE=
|
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27/go.mod h1:VQx0hjo2oUeQkQUET7wRwradO6f+fN5jzXgB/zROxxE=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/dokku/dokku/plugins/common"
|
"github.com/dokku/dokku/plugins/common"
|
||||||
"github.com/dokku/dokku/plugins/logs"
|
"github.com/dokku/dokku/plugins/logs"
|
||||||
|
|
||||||
|
flag "github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// main entrypoint to all subcommands
|
// main entrypoint to all subcommands
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ require (
|
|||||||
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
|
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
|
||||||
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
||||||
github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000
|
github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000
|
||||||
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/dokku/dokku/plugins/common => ../common
|
replace github.com/dokku/dokku/plugins/common => ../common
|
||||||
|
|||||||
@@ -6,3 +6,5 @@ github.com/joho/godotenv v1.2.0 h1:vGTvz69FzUFp+X4/bAkb0j5BoLC+9bpqTWY8mjhA9pc=
|
|||||||
github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/dokku/dokku/plugins/common"
|
"github.com/dokku/dokku/plugins/common"
|
||||||
"github.com/dokku/dokku/plugins/network"
|
"github.com/dokku/dokku/plugins/network"
|
||||||
|
|
||||||
|
flag "github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// main entrypoint to all subcommands
|
// main entrypoint to all subcommands
|
||||||
@@ -52,10 +53,12 @@ func main() {
|
|||||||
err = network.CommandRebuildall()
|
err = network.CommandRebuildall()
|
||||||
case "report":
|
case "report":
|
||||||
args := flag.NewFlagSet("network:report", flag.ExitOnError)
|
args := flag.NewFlagSet("network:report", flag.ExitOnError)
|
||||||
args.Parse(os.Args[2:])
|
osArgs, infoFlag, err := common.ParseReportArgs("network", os.Args[2:])
|
||||||
appName := args.Arg(0)
|
if err == nil {
|
||||||
infoFlag := args.Arg(1)
|
args.Parse(osArgs)
|
||||||
err = network.CommandReport(appName, infoFlag)
|
appName := args.Arg(0)
|
||||||
|
err = network.CommandReport(appName, infoFlag)
|
||||||
|
}
|
||||||
case "set":
|
case "set":
|
||||||
args := flag.NewFlagSet("network:set", flag.ExitOnError)
|
args := flag.NewFlagSet("network:set", flag.ExitOnError)
|
||||||
args.Parse(os.Args[2:])
|
args.Parse(os.Args[2:])
|
||||||
|
|||||||
@@ -124,11 +124,6 @@ func CommandRebuildall() error {
|
|||||||
|
|
||||||
// CommandReport displays a network report for one or more apps
|
// CommandReport displays a network report for one or more apps
|
||||||
func CommandReport(appName string, infoFlag string) error {
|
func CommandReport(appName string, infoFlag string) error {
|
||||||
if strings.HasPrefix(appName, "--") {
|
|
||||||
infoFlag = appName
|
|
||||||
appName = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(appName) == 0 {
|
if len(appName) == 0 {
|
||||||
apps, err := common.DokkuApps()
|
apps, err := common.DokkuApps()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ require (
|
|||||||
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
||||||
github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000
|
github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3
|
||||||
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/dokku/dokku/plugins/common => ../common
|
replace github.com/dokku/dokku/plugins/common => ../common
|
||||||
|
|||||||
@@ -6,3 +6,5 @@ github.com/joho/godotenv v1.2.0 h1:vGTvz69FzUFp+X4/bAkb0j5BoLC+9bpqTWY8mjhA9pc=
|
|||||||
github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/dokku/dokku/plugins/common"
|
"github.com/dokku/dokku/plugins/common"
|
||||||
"github.com/dokku/dokku/plugins/proxy"
|
"github.com/dokku/dokku/plugins/proxy"
|
||||||
|
|
||||||
|
flag "github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// main entrypoint to all subcommands
|
// main entrypoint to all subcommands
|
||||||
@@ -63,10 +64,12 @@ func main() {
|
|||||||
err = proxy.CommandPortsSet(appName, portMaps)
|
err = proxy.CommandPortsSet(appName, portMaps)
|
||||||
case "report":
|
case "report":
|
||||||
args := flag.NewFlagSet("proxy:report", flag.ExitOnError)
|
args := flag.NewFlagSet("proxy:report", flag.ExitOnError)
|
||||||
args.Parse(os.Args[2:])
|
osArgs, infoFlag, err := common.ParseReportArgs("proxy", os.Args[2:])
|
||||||
appName := args.Arg(0)
|
if err == nil {
|
||||||
infoFlag := args.Arg(1)
|
args.Parse(osArgs)
|
||||||
err = proxy.CommandReport(appName, infoFlag)
|
appName := args.Arg(0)
|
||||||
|
err = proxy.CommandReport(appName, infoFlag)
|
||||||
|
}
|
||||||
case "set":
|
case "set":
|
||||||
args := flag.NewFlagSet("proxy:set", flag.ExitOnError)
|
args := flag.NewFlagSet("proxy:set", flag.ExitOnError)
|
||||||
args.Parse(os.Args[2:])
|
args.Parse(os.Args[2:])
|
||||||
|
|||||||
@@ -155,11 +155,6 @@ func CommandPortsSet(appName string, portMaps []string) error {
|
|||||||
|
|
||||||
// CommandReport displays a proxy report for one or more apps
|
// CommandReport displays a proxy report for one or more apps
|
||||||
func CommandReport(appName string, infoFlag string) error {
|
func CommandReport(appName string, infoFlag string) error {
|
||||||
if strings.HasPrefix(appName, "--") {
|
|
||||||
infoFlag = appName
|
|
||||||
appName = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(appName) == 0 {
|
if len(appName) == 0 {
|
||||||
apps, err := common.DokkuApps()
|
apps, err := common.DokkuApps()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ require (
|
|||||||
github.com/dokku/dokku/plugins/docker-options v0.0.0-00010101000000-000000000000
|
github.com/dokku/dokku/plugins/docker-options v0.0.0-00010101000000-000000000000
|
||||||
github.com/gofrs/flock v0.8.0
|
github.com/gofrs/flock v0.8.0
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3
|
||||||
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/dokku/dokku/plugins/common => ../common
|
replace github.com/dokku/dokku/plugins/common => ../common
|
||||||
|
|||||||
@@ -10,3 +10,5 @@ github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqx
|
|||||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/dokku/dokku/plugins/common"
|
"github.com/dokku/dokku/plugins/common"
|
||||||
"github.com/dokku/dokku/plugins/ps"
|
"github.com/dokku/dokku/plugins/ps"
|
||||||
|
|
||||||
|
flag "github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// main entrypoint to all subcommands
|
// main entrypoint to all subcommands
|
||||||
@@ -31,10 +32,12 @@ func main() {
|
|||||||
err = ps.CommandRebuild(appName, *allApps, *parallelCount)
|
err = ps.CommandRebuild(appName, *allApps, *parallelCount)
|
||||||
case "report":
|
case "report":
|
||||||
args := flag.NewFlagSet("ps:report", flag.ExitOnError)
|
args := flag.NewFlagSet("ps:report", flag.ExitOnError)
|
||||||
args.Parse(os.Args[2:])
|
osArgs, infoFlag, err := common.ParseReportArgs("ps", os.Args[2:])
|
||||||
appName := args.Arg(0)
|
if err == nil {
|
||||||
infoFlag := args.Arg(1)
|
args.Parse(osArgs)
|
||||||
err = ps.CommandReport(appName, infoFlag)
|
appName := args.Arg(0)
|
||||||
|
err = ps.CommandReport(appName, infoFlag)
|
||||||
|
}
|
||||||
case "restart":
|
case "restart":
|
||||||
args := flag.NewFlagSet("ps:restart", flag.ExitOnError)
|
args := flag.NewFlagSet("ps:restart", flag.ExitOnError)
|
||||||
allApps := args.Bool("all", false, "--all: restart all apps")
|
allApps := args.Bool("all", false, "--all: restart all apps")
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
|
||||||
|
|
||||||
dockeroptions "github.com/dokku/dokku/plugins/docker-options"
|
dockeroptions "github.com/dokku/dokku/plugins/docker-options"
|
||||||
|
|
||||||
@@ -45,11 +44,6 @@ func CommandRebuild(appName string, allApps bool, parallelCount int) error {
|
|||||||
|
|
||||||
// CommandReport displays a ps report for one or more apps
|
// CommandReport displays a ps report for one or more apps
|
||||||
func CommandReport(appName string, infoFlag string) error {
|
func CommandReport(appName string, infoFlag string) error {
|
||||||
if strings.HasPrefix(appName, "--") {
|
|
||||||
infoFlag = appName
|
|
||||||
appName = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(appName) == 0 {
|
if len(appName) == 0 {
|
||||||
apps, err := common.DokkuApps()
|
apps, err := common.DokkuApps()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ require (
|
|||||||
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 // indirect
|
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 // indirect
|
||||||
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
||||||
github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000
|
github.com/dokku/dokku/plugins/config v0.0.0-00010101000000-000000000000
|
||||||
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/dokku/dokku/plugins/common => ../common
|
replace github.com/dokku/dokku/plugins/common => ../common
|
||||||
|
|||||||
@@ -6,3 +6,5 @@ github.com/joho/godotenv v1.2.0 h1:vGTvz69FzUFp+X4/bAkb0j5BoLC+9bpqTWY8mjhA9pc=
|
|||||||
github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/dokku/dokku/plugins/common"
|
"github.com/dokku/dokku/plugins/common"
|
||||||
"github.com/dokku/dokku/plugins/repo"
|
"github.com/dokku/dokku/plugins/repo"
|
||||||
|
|
||||||
|
flag "github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// main entrypoint to all subcommands
|
// main entrypoint to all subcommands
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ go 1.14
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 // indirect
|
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 // indirect
|
||||||
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3
|
||||||
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/dokku/dokku/plugins/common => ../common
|
replace github.com/dokku/dokku/plugins/common => ../common
|
||||||
|
|||||||
@@ -4,3 +4,5 @@ github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 h1:HHUr4P/aKh4qu
|
|||||||
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27/go.mod h1:VQx0hjo2oUeQkQUET7wRwradO6f+fN5jzXgB/zROxxE=
|
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27/go.mod h1:VQx0hjo2oUeQkQUET7wRwradO6f+fN5jzXgB/zROxxE=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
||||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/dokku/dokku/plugins/common"
|
"github.com/dokku/dokku/plugins/common"
|
||||||
"github.com/dokku/dokku/plugins/resource"
|
"github.com/dokku/dokku/plugins/resource"
|
||||||
|
|
||||||
|
flag "github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// main entrypoint to all subcommands
|
// main entrypoint to all subcommands
|
||||||
@@ -49,10 +50,12 @@ func main() {
|
|||||||
err = resource.CommandLimitClear(appName, *processType)
|
err = resource.CommandLimitClear(appName, *processType)
|
||||||
case "report":
|
case "report":
|
||||||
args := flag.NewFlagSet("resource:report", flag.ExitOnError)
|
args := flag.NewFlagSet("resource:report", flag.ExitOnError)
|
||||||
args.Parse(os.Args[2:])
|
osArgs, infoFlag, err := common.ParseReportArgs("resource", os.Args[2:])
|
||||||
appName := args.Arg(0)
|
if err == nil {
|
||||||
infoFlag := args.Arg(1)
|
args.Parse(osArgs)
|
||||||
err = resource.CommandReport(appName, infoFlag)
|
appName := args.Arg(0)
|
||||||
|
err = resource.CommandReport(appName, infoFlag)
|
||||||
|
}
|
||||||
case "reserve":
|
case "reserve":
|
||||||
args := flag.NewFlagSet("resource:reserve", flag.ExitOnError)
|
args := flag.NewFlagSet("resource:reserve", flag.ExitOnError)
|
||||||
processType := args.String("process-type", "", "process-type: A process type to manage")
|
processType := args.String("process-type", "", "process-type: A process type to manage")
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package resource
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/dokku/dokku/plugins/common"
|
"github.com/dokku/dokku/plugins/common"
|
||||||
)
|
)
|
||||||
@@ -28,11 +27,6 @@ func CommandLimitClear(appName string, processType string) error {
|
|||||||
|
|
||||||
// CommandReport displays a resource report for one or more apps
|
// CommandReport displays a resource report for one or more apps
|
||||||
func CommandReport(appName string, infoFlag string) error {
|
func CommandReport(appName string, infoFlag string) error {
|
||||||
if strings.HasPrefix(appName, "--") {
|
|
||||||
infoFlag = appName
|
|
||||||
appName = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(appName) == 0 {
|
if len(appName) == 0 {
|
||||||
apps, err := common.DokkuApps()
|
apps, err := common.DokkuApps()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -29,6 +29,48 @@ teardown() {
|
|||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "(client) arg parsing" {
|
||||||
|
run /bin/bash -c "dokku config:set --global GLOBAL_KEY=VALUE"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run /bin/bash -c "dokku config:set $TEST_APP APP_KEY=VALUE"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run /bin/bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh --app $TEST_APP config:export --merged --format shell"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
common_output="$output"
|
||||||
|
run /bin/bash -c "dokku config:export $TEST_APP --merged --format shell"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output "$common_output"
|
||||||
|
|
||||||
|
run /bin/bash -c "dokku config:export --merged $TEST_APP --format shell"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output "$common_output"
|
||||||
|
|
||||||
|
run /bin/bash -c "dokku config:export --merged --format shell $TEST_APP"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output "$common_output"
|
||||||
|
|
||||||
|
run /bin/bash -c "dokku --app $TEST_APP config:export --merged --format shell"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output "$common_output"
|
||||||
|
}
|
||||||
|
|
||||||
@test "(client) apps:create AND apps:destroy with random name" {
|
@test "(client) apps:create AND apps:destroy with random name" {
|
||||||
setup_client_repo
|
setup_client_repo
|
||||||
run /bin/bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh apps:create"
|
run /bin/bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh apps:create"
|
||||||
|
|||||||
Reference in New Issue
Block a user