Skip to content

Commit c13ce53

Browse files
committed
add organization to select prompt
1 parent 632c1d6 commit c13ce53

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cli/create.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,26 @@ func (r *RootCmd) create() *serpent.Command {
109109

110110
templateNames := make([]string, 0, len(templates))
111111
templateByName := make(map[string]codersdk.Template, len(templates))
112+
uniqueOrganizations := make(map[uuid.UUID]bool)
113+
for _, template := range templates {
114+
uniqueOrganizations[template.OrganizationID] = true
115+
}
112116

113117
for _, template := range templates {
114118
templateName := template.Name
119+
if len(uniqueOrganizations) > 1 {
120+
templateName += cliui.Placeholder(
121+
fmt.Sprintf(
122+
" (%s)",
123+
template.OrganizationName,
124+
),
125+
)
126+
}
115127

116128
if template.ActiveUserCount > 0 {
117129
templateName += cliui.Placeholder(
118130
fmt.Sprintf(
119-
" (used by %s)",
131+
" used by %s",
120132
formatActiveDevelopers(template.ActiveUserCount),
121133
),
122134
)

0 commit comments

Comments
 (0)