Skip to content

Commit f9e5889

Browse files
author
Tobias Fuhrimann
committed
Fix invitation types
1 parent 4b988d0 commit f9e5889

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

invitation.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ func invitationEntityTypeAndName(inv Invitation) (string, string) {
4545
var entityType string
4646
var entityName string
4747
if inv.Entity.AccountID != "" {
48-
entityType = "Billing Account"
48+
entityType = "account"
4949
entityName = inv.Entity.AccountName
5050
}
5151
if inv.Entity.OrganizationID != "" {
52-
entityType = "Org "
52+
entityType = "organization"
5353
entityName = inv.Entity.OrganizationName
5454
}
5555
if inv.Entity.SpaceID != "" {
56-
entityType = "Space "
56+
entityType = "space"
5757
entityName = fmt.Sprintf("%s / %s", inv.Entity.OrganizationName, inv.Entity.SpaceName)
5858
}
5959

invitations.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,21 @@ func (p *AppCloudPlugin) Invitations(c plugin.CliConnection) error {
3030
fmt.Println(bold("GUID entity type entity"))
3131
for _, inv := range invitations {
3232
entityType, entityName := invitationEntityTypeAndName(inv)
33-
fmt.Printf("%s %s %s\n", inv.Metadata.GUID, entityType, entityName)
33+
fmt.Printf("%s %s %s\n", inv.Metadata.GUID, formatEntityType(entityType), entityName)
3434
}
3535
return nil
3636
}
37+
38+
// formatEntityType formats an entity name more nicely.
39+
func formatEntityType(t string) string {
40+
switch t {
41+
case "account":
42+
return "Billing Account"
43+
case "organization":
44+
return "Org "
45+
case "space":
46+
return "Space "
47+
default:
48+
return "unknown "
49+
}
50+
}

invite_org_user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func (p *AppCloudPlugin) InviteOrgUser(c plugin.CliConnection, invitee string, o
2323
username = "you"
2424
}
2525

26-
fmt.Printf("Inviting %s to org %s as %s\n...", cyanBold(invitee), cyanBold(orgName), cyanBold(username))
26+
fmt.Printf("Inviting %s to org %s as %s...\n", cyanBold(invitee), cyanBold(orgName), cyanBold(username))
2727

2828
o, err := c.GetOrg(orgName)
2929
if err != nil {

0 commit comments

Comments
 (0)