diff --git a/internal/codespaces/api/api.go b/internal/codespaces/api/api.go index 2a859f3ac..790ad0ee4 100644 --- a/internal/codespaces/api/api.go +++ b/internal/codespaces/api/api.go @@ -52,6 +52,13 @@ const ( vscsAPI = "https://online.visualstudio.com" ) +const ( + VSCSTargetLocal = "local" + VSCSTargetDevelopment = "development" + VSCSTargetPPE = "ppe" + VSCSTargetProduction = "production" +) + // API is the interface to the codespace service. type API struct { client httpClient diff --git a/pkg/cmd/codespace/list.go b/pkg/cmd/codespace/list.go index 987ed00af..17c7b6414 100644 --- a/pkg/cmd/codespace/list.go +++ b/pkg/cmd/codespace/list.go @@ -45,8 +45,9 @@ func (a *App) List(ctx context.Context, limit int, exporter cmdutil.Exporter) er hasNonProdVSCSTarget := false for _, apiCodespace := range codespaces { - if apiCodespace.VSCSTarget != "prod" { + if apiCodespace.VSCSTarget != "" && apiCodespace.VSCSTarget != api.VSCSTargetProduction { hasNonProdVSCSTarget = true + break } } @@ -114,11 +115,11 @@ func (a *App) List(ctx context.Context, limit int, exporter cmdutil.Exporter) er } func formatNameForVSCSTarget(name, vscsTarget string) string { - if vscsTarget == "dev" || vscsTarget == "local" { + if vscsTarget == api.VSCSTargetDevelopment || vscsTarget == api.VSCSTargetLocal { return fmt.Sprintf("%s 🚧", name) } - if vscsTarget == "ppe" { + if vscsTarget == api.VSCSTargetPPE { return fmt.Sprintf("%s ✨", name) }