func (v *CmdPGPGen) ParseArgv(ctx *cli.Context) (err error) { nargs := len(ctx.Args()) if nargs != 0 { err = fmt.Errorf("pgp gen takes 0 args") } else { g := libkb.PGPGenArg{} g.PGPUids = ctx.StringSlice("pgp-uid") v.arg.DoExport = !ctx.Bool("no-export") v.arg.AllowMulti = ctx.Bool("multi") if ctx.Bool("debug") { g.PrimaryBits = SmallKey g.SubkeyBits = SmallKey } v.arg.Gen = &g } return err }
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 }
func (v *CmdPGPGen) ParseArgv(ctx *cli.Context) (err error) { nargs := len(ctx.Args()) if nargs != 0 { err = fmt.Errorf("pgp gen takes 0 args") } else { g := libkb.PGPGenArg{} g.PGPUids = ctx.StringSlice("pgp-uid") g.NoDefPGPUid = ctx.Bool("no-default-pgp-uid") v.arg.AllowMulti = ctx.Bool("multi") v.arg.DoExport = !ctx.Bool("no-export") if g.NoDefPGPUid && len(g.PGPUids) == 0 { err = fmt.Errorf("if you don't want the default PGP uid, you must supply a PGP uid with the --pgp-uid option") } if ctx.Bool("debug") { g.PrimaryBits = SmallKey g.SubkeyBits = SmallKey } v.arg.Gen = &g } return err }