func (c *CmdAPICall) ParseArgv(ctx *cli.Context) error { var err error nargs := len(ctx.Args()) if nargs == 0 { return fmt.Errorf("endpoint is required") } c.endpoint = ctx.Args()[0] if c.method, err = c.validateMethod(ctx.String("method")); err != nil { return err } args := ctx.StringSlice("arg") for _, a := range args { pa, err := c.parseArgument(a) if err != nil { return err } c.addArgument(pa) } httpStatuses := ctx.IntSlice("status") for _, h := range httpStatuses { c.httpStatuses = append(c.httpStatuses, h) } appStatuses := ctx.IntSlice("appstatus") for _, a := range appStatuses { c.appStatuses = append(c.appStatuses, a) } payload := ctx.String("json-payload") if payload != "" { if c.JSONPayload, err = c.parseJSONPayload(payload); err != nil { return err } } return nil }