func (c *showBudgetCommand) Run(ctx *cmd.Context) error { client, err := c.BakeryClient() if err != nil { return errors.Annotate(err, "failed to create an http client") } api, err := newBudgetAPIClient(client) if err != nil { return errors.Annotate(err, "failed to create an api client") } budget, err := api.GetBudget(c.budget) if err != nil { return errors.Annotate(err, "failed to retrieve the budget") } c.resolveModelNames(budget) err = c.out.Write(ctx, budget) return errors.Trace(err) }
func (c *showBudgetCommand) Run(ctx *cmd.Context) error { defer c.Close() client, err := c.NewClient() if err != nil { return errors.Annotate(err, "failed to create an http client") } api, err := newAPIClient(client) if err != nil { return errors.Annotate(err, "failed to create an api client") } budget, err := api.GetBudget(c.budget) if err != nil { return errors.Annotate(err, "failed to retrieve the budget") } err = c.out.Write(ctx, budget) if err != nil { return errors.Trace(err) } return nil }