Skip to content

Commit 258e8cd

Browse files
committed
update output
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
1 parent 5c834f0 commit 258e8cd

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

app/cli/cmd/organization_describe.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ func contextTableOutput(config *action.ConfigContextItem) error {
4747
gt := output.NewTableWriter()
4848
gt.SetTitle("Current Context")
4949

50-
userInfo := config.CurrentUser.PrintUserProfileWithEmail()
51-
if config.CurrentUser.InstanceAdmin {
52-
userInfo += "\nInstance admin=true"
53-
}
54-
gt.AppendRow(table.Row{"Logged in as", userInfo})
50+
gt.AppendRow(table.Row{"Logged in as", config.CurrentUser.PrintUserProfileWithEmail()})
5551
gt.AppendSeparator()
5652

5753
if m := config.CurrentMembership; m != nil {

app/cli/pkg/action/config_current_context.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,19 @@ func (u *UserItem) PrintUserProfileWithEmail() string {
5959
name = u.LastName
6060
}
6161

62+
var result string
6263
// If we have a name, format with email, otherwise just return email
6364
if name != "" {
64-
return name + " <" + u.Email + ">"
65+
result = name + " <" + u.Email + ">"
66+
} else {
67+
result = u.Email
6568
}
66-
return u.Email
69+
70+
if u.InstanceAdmin {
71+
result += " (Instance admin)"
72+
}
73+
74+
return result
6775
}
6876

6977
func (action *ConfigCurrentContext) Run() (*ConfigContextItem, error) {

0 commit comments

Comments
 (0)