hack: parse out the info flags for report subcommands separately
pflag doesn't ignore unspecified arguments, so they must be parsed out separately first.
This commit is contained in:
@@ -50,10 +50,12 @@ func main() {
|
||||
err = resource.CommandLimitClear(appName, *processType)
|
||||
case "report":
|
||||
args := flag.NewFlagSet("resource:report", flag.ExitOnError)
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
infoFlag := args.Arg(1)
|
||||
err = resource.CommandReport(appName, infoFlag)
|
||||
osArgs, infoFlag, err := common.ParseReportArgs("resource", os.Args[2:])
|
||||
if err == nil {
|
||||
args.Parse(osArgs)
|
||||
appName := args.Arg(0)
|
||||
err = resource.CommandReport(appName, infoFlag)
|
||||
}
|
||||
case "reserve":
|
||||
args := flag.NewFlagSet("resource:reserve", flag.ExitOnError)
|
||||
processType := args.String("process-type", "", "process-type: A process type to manage")
|
||||
|
||||
@@ -2,7 +2,6 @@ package resource
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"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
|
||||
func CommandReport(appName string, infoFlag string) error {
|
||||
if strings.HasPrefix(appName, "--") {
|
||||
infoFlag = appName
|
||||
appName = ""
|
||||
}
|
||||
|
||||
if len(appName) == 0 {
|
||||
apps, err := common.DokkuApps()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user