func (command *commandGenerate) Execute(resource *handler.Resource) { opts := resource.Params.(*paramsGenerate).opts keypair, err := keypairs.Create(command.Ctx.ServiceClient, opts).Extract() if err != nil { resource.Err = err return } resource.Result = structs.Map(keypair) }
func (command *commandGenerate) Execute(resource *handler.Resource) { opts := resource.Params.(*paramsGenerate).opts keypair, err := keypairs.Create(command.Ctx.ServiceClient, opts).Extract() if err != nil { resource.Err = err return } if command.Ctx.OutputFormat == "json" || command.Ctx.OutputFormat == "csv" { resource.Result = structs.Map(keypair) } else { resource.Result = printGenerate(keypair) } }
func (command *commandGenerate) Execute(resource *handler.Resource) { opts := resource.Params.(*paramsGenerate).opts keypair, err := keypairs.Create(command.Ctx.ServiceClient, opts).Extract() if err != nil { resource.Err = err return } c := command.Ctx.CLIContext if c.IsSet("json") || c.IsSet("csv") || c.GlobalIsSet("json") || c.GlobalIsSet("csv") { resource.Result = structs.Map(keypair) } else { resource.Result = printGenerate(keypair) } }