Skip to content

Commit daca7a2

Browse files
authored
uppercase table headers (#1304)
1 parent 3d31fe3 commit daca7a2

File tree

7 files changed

+16
-15
lines changed

7 files changed

+16
-15
lines changed

src/cmd/cli/command/deploymentinfo_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestPrintServiceStatesAndEndpointsAndDomainname(t *testing.T) {
6666
},
6767
},
6868
expectedLines: []string{
69-
"Deployment Name Status Endpoints DomainName",
69+
"DEPLOYMENT NAME STATUS ENDPOINTS DOMAINNAME",
7070
" service1 NOT_SPECIFIED N/A https://example.com",
7171
" * Run `defang cert generate` to get a TLS certificate for your service(s)",
7272
"",
@@ -92,7 +92,7 @@ func TestPrintServiceStatesAndEndpointsAndDomainname(t *testing.T) {
9292
},
9393
},
9494
expectedLines: []string{
95-
"Deployment Name Status Endpoints DomainName",
95+
"DEPLOYMENT NAME STATUS ENDPOINTS DOMAINNAME",
9696
" service1 NOT_SPECIFIED https://example.com, service1.internal:80 https://example.com",
9797
" * Run `defang cert generate` to get a TLS certificate for your service(s)",
9898
"",
@@ -116,7 +116,7 @@ func TestPrintServiceStatesAndEndpointsAndDomainname(t *testing.T) {
116116
},
117117
},
118118
expectedLines: []string{
119-
"Deployment Name Status Endpoints",
119+
"DEPLOYMENT NAME STATUS ENDPOINTS",
120120
" service1 NOT_SPECIFIED https://service1",
121121
"",
122122
},

src/cmd/cli/command/estimate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ updates, so there may be small windows of downtime during redeployment.
135135
Services will be exposed directly to the public internet for easy debugging.
136136
This mode emphasizes affordability over availability.
137137
138-
Cost Quantity Service Description
138+
COST QUANTITY SERVICE DESCRIPTION
139139
$1.62 14600 GB-Hours app AmazonECS USW2-Fargate-EphemeralStorage-GB-Hours (20 GB * 730 hours)
140140
$6.49 1460 GB-Hours app AmazonECS USW2-Fargate-GB-Hours (2 GB * 730 hours)
141141
-$4.54 1460 GB-Hours app AmazonECS USW2-Fargate-GB-Hours-SpotDiscount (Estimated @ 70%)

src/pkg/cli/configList_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func TestConfigList(t *testing.T) {
7777
t.Fatalf("ConfigList() error = %v", err)
7878
}
7979

80-
expectedOutput := "\x1b[1m\nName\x1b[0m" + `
80+
expectedOutput := "\x1b[1m\nNAME\x1b[0m" + `
8181
foo
8282
bar
8383
`

src/pkg/cli/deploymentsList_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func TestDeploymentsList(t *testing.T) {
7979
if err != nil {
8080
t.Fatalf("DeploymentsList() error = %v", err)
8181
}
82-
expectedOutput := "\x1b[1m\nProjectName Provider AccountId Region Deployment DeployedAt\x1b[0m" + `
82+
expectedOutput := "\x1b[1m\nPROJECTNAME PROVIDER ACCOUNTID REGION DEPLOYMENT DEPLOYEDAT\x1b[0m" + `
8383
test defang 1234567890 us-test-2 a1b2c3 ` + time.Time{}.Local().Format(time.RFC3339) + "\n"
8484

8585
receivedLines := strings.Split(stdout.String(), "\n")

src/pkg/cli/estimate.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ import (
1212
"time"
1313

1414
"github.com/DefangLabs/defang/src/pkg/cli/client"
15-
cliClient "github.com/DefangLabs/defang/src/pkg/cli/client"
1615
"github.com/DefangLabs/defang/src/pkg/cli/compose"
1716
"github.com/DefangLabs/defang/src/pkg/logs"
1817
"github.com/DefangLabs/defang/src/pkg/money"
1918
"github.com/DefangLabs/defang/src/pkg/term"
2019
defangv1 "github.com/DefangLabs/defang/src/protos/io/defang/v1"
2120
)
2221

23-
func RunEstimate(ctx context.Context, project *compose.Project, client cliClient.FabricClient, previewProvider cliClient.Provider, estimateProviderID cliClient.ProviderID, region string, mode defangv1.DeploymentMode) (*defangv1.EstimateResponse, error) {
22+
func RunEstimate(ctx context.Context, project *compose.Project, client client.FabricClient, previewProvider client.Provider, estimateProviderID client.ProviderID, region string, mode defangv1.DeploymentMode) (*defangv1.EstimateResponse, error) {
2423
term.Debugf("Running estimate for project %s in region %s with mode %s", project.Name, region, mode)
2524
preview, err := GeneratePreview(ctx, project, client, previewProvider, estimateProviderID, mode, region)
2625
if err != nil {
@@ -40,7 +39,7 @@ func RunEstimate(ctx context.Context, project *compose.Project, client cliClient
4039
return estimate, nil
4140
}
4241

43-
func GeneratePreview(ctx context.Context, project *compose.Project, client client.FabricClient, previewProvider cliClient.Provider, estimateProviderID cliClient.ProviderID, mode defangv1.DeploymentMode, region string) (string, error) {
42+
func GeneratePreview(ctx context.Context, project *compose.Project, client client.FabricClient, previewProvider client.Provider, estimateProviderID client.ProviderID, mode defangv1.DeploymentMode, region string) (string, error) {
4443
os.Setenv("DEFANG_JSON", "1") // HACK: always show JSON output for estimate
4544
since := time.Now()
4645

@@ -111,16 +110,17 @@ func PrintEstimate(mode defangv1.DeploymentMode, estimate *defangv1.EstimateResp
111110
subtotal := (*money.Money)(estimate.Subtotal)
112111
tableItems := prepareEstimateLineItemTableItems(estimate.LineItems)
113112
term.Println("")
114-
if mode == defangv1.DeploymentMode_DEVELOPMENT || mode == defangv1.DeploymentMode_MODE_UNSPECIFIED {
113+
switch mode {
114+
case defangv1.DeploymentMode_DEVELOPMENT, defangv1.DeploymentMode_MODE_UNSPECIFIED:
115115
term.Println("Estimate for Deployment Mode: AFFORDABLE")
116116
term.Println(affordableModeEstimateSummary)
117-
} else if mode == defangv1.DeploymentMode_STAGING {
117+
case defangv1.DeploymentMode_STAGING:
118118
term.Println("Estimate for Deployment Mode: BALANCED")
119119
term.Println(balancedModeEstimateSummary)
120-
} else if mode == defangv1.DeploymentMode_PRODUCTION {
120+
case defangv1.DeploymentMode_PRODUCTION:
121121
term.Println("Estimate for Deployment Mode: HIGH_AVAILABILITY")
122122
term.Println(highAvailabilityModeEstimateSummary)
123-
} else {
123+
default:
124124
term.Printf("Estimate for %s Mode\n", mode.String())
125125
}
126126

src/pkg/cli/getServices_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func TestGetServices(t *testing.T) {
8585
if err != nil {
8686
t.Fatalf("GetServices() error = %v", err)
8787
}
88-
expectedOutput := "\x1b[1m\nService Deployment PublicFqdn PrivateFqdn Status\x1b[0m" + `
88+
expectedOutput := "\x1b[1m\nSERVICE DEPLOYMENT PUBLICFQDN PRIVATEFQDN STATUS\x1b[0m" + `
8989
foo a1b2c3 test-foo.prod1.defang.dev UNKNOWN
9090
`
9191

src/pkg/term/table.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"errors"
55
"fmt"
66
"reflect"
7+
"strings"
78
"text/tabwriter"
89
)
910

@@ -35,7 +36,7 @@ func (t *Term) Table(slice interface{}, attributes ...string) error {
3536
if i > 0 {
3637
prefix = "\t"
3738
}
38-
_, err = fmt.Fprint(w, prefix, attr)
39+
_, err = fmt.Fprint(w, prefix, strings.ToUpper(attr))
3940
if err != nil {
4041
return err
4142
}

0 commit comments

Comments
 (0)