| 51 | } |
| 52 | |
| 53 | func (c *Create) Perform(ctx context.Context, drv *ui.Driver) (*api.Organization, error) { |
| 54 | cfg := cli.ConfigFromContext(ctx) |
| 55 | |
| 56 | var err error |
| 57 | c.OrgName, err = c.orgName(ctx, cfg, drv) |
| 58 | if err != nil { |
| 59 | return nil, err |
| 60 | } |
| 61 | drv.Activate(ctx, &models.CreateOrgSpinner{}) |
| 62 | |
| 63 | org, err := c.Anc.CreateOrg(ctx, c.OrgName) |
| 64 | if err != nil { |
| 65 | return nil, err |
| 66 | } |
| 67 | |
| 68 | drv.Send(ui.HideModelsMsg{ |
| 69 | Models: []string{"CreateOrgNameInput", "CreateOrgSpinner"}, |
| 70 | }) |
| 71 | |
| 72 | drv.Activate(ctx, &models.CreateOrgResult{ |
| 73 | Org: *org, |
| 74 | }) |
| 75 | |
| 76 | return org, nil |
| 77 | } |
| 78 | |
| 79 | func (c *Create) orgName(ctx context.Context, cfg *cli.Config, drv *ui.Driver) (string, error) { |
| 80 | if c.OrgName != "" { |