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:
@@ -64,10 +64,12 @@ func main() {
|
||||
err = proxy.CommandPortsSet(appName, portMaps)
|
||||
case "report":
|
||||
args := flag.NewFlagSet("proxy:report", flag.ExitOnError)
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
infoFlag := args.Arg(1)
|
||||
err = proxy.CommandReport(appName, infoFlag)
|
||||
osArgs, infoFlag, err := common.ParseReportArgs("proxy", os.Args[2:])
|
||||
if err == nil {
|
||||
args.Parse(osArgs)
|
||||
appName := args.Arg(0)
|
||||
err = proxy.CommandReport(appName, infoFlag)
|
||||
}
|
||||
case "set":
|
||||
args := flag.NewFlagSet("proxy:set", flag.ExitOnError)
|
||||
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
|
||||
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