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:
@@ -32,10 +32,12 @@ func main() {
|
||||
err = ps.CommandRebuild(appName, *allApps, *parallelCount)
|
||||
case "report":
|
||||
args := flag.NewFlagSet("ps:report", flag.ExitOnError)
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
infoFlag := args.Arg(1)
|
||||
err = ps.CommandReport(appName, infoFlag)
|
||||
osArgs, infoFlag, err := common.ParseReportArgs("ps", os.Args[2:])
|
||||
if err == nil {
|
||||
args.Parse(osArgs)
|
||||
appName := args.Arg(0)
|
||||
err = ps.CommandReport(appName, infoFlag)
|
||||
}
|
||||
case "restart":
|
||||
args := flag.NewFlagSet("ps:restart", flag.ExitOnError)
|
||||
allApps := args.Bool("all", false, "--all: restart all apps")
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
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
|
||||
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