Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Add full project name and CLI default to the acorn project json output
Browse files Browse the repository at this point in the history
Signed-off-by: Darren Shepherd <[email protected]>
  • Loading branch information
ibuildthecloud committed Jul 7, 2023
1 parent 0184d27 commit b3cc45e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pkg/cli/project.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cli

import (
"fmt"
"sort"

"github.com/acorn-io/baaah/pkg/typed"
Expand Down Expand Up @@ -99,13 +100,22 @@ func (a *Project) Run(cmd *cobra.Command, args []string) error {
continue
}
if projectItem.Project != nil {
if projectItem.Project.Annotations == nil {
projectItem.Project.Annotations = map[string]string{}
}
projectItem.Project.Annotations["project-name"] = projectItem.FullName
projectItem.Project.Annotations["default-project"] = fmt.Sprint(defaultProject == projectItem.FullName)

supportedRegions := projectItem.Project.Status.SupportedRegions
defaultRegion := projectItem.Project.Status.DefaultRegion
for i, supportedRegion := range supportedRegions {
if supportedRegion == defaultRegion {
supportedRegions[i] = supportedRegion + "*"
if len(supportedRegions) > 1 {
for i, supportedRegion := range supportedRegions {
if supportedRegion == defaultRegion {
supportedRegions[i] = supportedRegion + "*"
}
}
}

out.WriteFormatted(projectEntry{
Name: projectItem.FullName,
Default: defaultProject == projectItem.FullName,
Expand Down

0 comments on commit b3cc45e

Please sign in to comment.