X Tutup
Skip to content

Commit 94128d6

Browse files
committed
Add consts for targets and treat empty as prod
1 parent 5e62a41 commit 94128d6

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

internal/codespaces/api/api.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ const (
5252
vscsAPI = "https://online.visualstudio.com"
5353
)
5454

55+
const (
56+
VSCSTargetLocal = "local"
57+
VSCSTargetDevelopment = "development"
58+
VSCSTargetPPE = "ppe"
59+
VSCSTargetProduction = "production"
60+
)
61+
5562
// API is the interface to the codespace service.
5663
type API struct {
5764
client httpClient

pkg/cmd/codespace/list.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ func (a *App) List(ctx context.Context, limit int, exporter cmdutil.Exporter) er
4545

4646
hasNonProdVSCSTarget := false
4747
for _, apiCodespace := range codespaces {
48-
if apiCodespace.VSCSTarget != "prod" {
48+
if apiCodespace.VSCSTarget != "" && apiCodespace.VSCSTarget != api.VSCSTargetProduction {
4949
hasNonProdVSCSTarget = true
50+
break
5051
}
5152
}
5253

@@ -114,11 +115,11 @@ func (a *App) List(ctx context.Context, limit int, exporter cmdutil.Exporter) er
114115
}
115116

116117
func formatNameForVSCSTarget(name, vscsTarget string) string {
117-
if vscsTarget == "dev" || vscsTarget == "local" {
118+
if vscsTarget == api.VSCSTargetDevelopment || vscsTarget == api.VSCSTargetLocal {
118119
return fmt.Sprintf("%s 🚧", name)
119120
}
120121

121-
if vscsTarget == "ppe" {
122+
if vscsTarget == api.VSCSTargetPPE {
122123
return fmt.Sprintf("%s ✨", name)
123124
}
124125

0 commit comments

Comments
 (0)
X Tutup