Skip to content

Commit 9baf430

Browse files
committed
Show only project name when using the short option
When using the short option, show ony the project name without the DisplayName to stay consistent for scripting. Don't display msg about non membership of a project as well when using the short option to project. Fixes #12267
1 parent da967d5 commit 9baf430

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/cmd/cli/cmd/projects.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,12 @@ func (o ProjectsOptions) RunProjects() error {
141141
if err == nil {
142142
switch len(projects) {
143143
case 0:
144-
msg += "You are not a member of any projects. You can request a project to be created with the 'new-project' command."
144+
if !o.DisplayShort {
145+
msg += "You are not a member of any projects. You can request a project to be created with the 'new-project' command."
146+
}
145147
case 1:
146148
if o.DisplayShort {
147-
msg += fmt.Sprintf("%s", api.DisplayNameAndNameForProject(&projects[0]))
149+
msg += fmt.Sprintf("%s", projects[0].Name)
148150
} else {
149151
msg += fmt.Sprintf("You have one project on this server: %q.", api.DisplayNameAndNameForProject(&projects[0]))
150152
}

0 commit comments

Comments
 (0)