Skip to content

Commit

Permalink
fix: inconsistent formatting in "describe" commands (#593)
Browse files Browse the repository at this point in the history
Removes duplicate entries, adds whitespace (newlines & tabs) where
necessary
  • Loading branch information
phm07 committed Oct 31, 2023
1 parent 7e511d9 commit b70dfe3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 5 additions & 5 deletions internal/cmd/certificate/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ var DescribeCmd = base.DescribeCmd{
fmt.Printf("Not valid after:\t%s (%s)\n", util.Datetime(cert.NotValidAfter), humanize.Time(cert.NotValidAfter))
if cert.Status != nil {
fmt.Printf("Status:\n")
fmt.Printf(" Issuance: %s\n", cert.Status.Issuance)
fmt.Printf(" Renewal: %s\n", cert.Status.Renewal)
fmt.Printf(" Issuance:\t%s\n", cert.Status.Issuance)
fmt.Printf(" Renewal:\t%s\n", cert.Status.Renewal)
if cert.Status.IsFailed() {
fmt.Printf(" Failure reason: %s\n", cert.Status.Error.Message)
}
Expand All @@ -56,15 +56,15 @@ var DescribeCmd = base.DescribeCmd{
fmt.Println(" Certificate unused")
} else {
for _, ub := range cert.UsedBy {
fmt.Printf(" - Type: %s", ub.Type)
fmt.Printf(" - Type: %s\n", ub.Type)
// Currently certificates can be only attached to load balancers.
// If we ever get something that is not a load balancer fall back
// to printing the ID.
if ub.Type != hcloud.CertificateUsedByRefTypeLoadBalancer {
fmt.Printf(" - ID: %d", ub.ID)
fmt.Printf(" - ID: %d\n", ub.ID)
continue
}
fmt.Printf(" - Name: %s", client.LoadBalancer().LoadBalancerName(ub.ID))
fmt.Printf(" - Name: %s\n", client.LoadBalancer().LoadBalancerName(ub.ID))
}
}
return nil
Expand Down
1 change: 0 additions & 1 deletion internal/cmd/datacenter/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var DescribeCmd = base.DescribeCmd{
PrintText: func(ctx context.Context, client hcapi2.Client, cmd *cobra.Command, resource interface{}) error {
datacenter := resource.(*hcloud.Datacenter)

fmt.Printf("ID:\t\t%d\n", datacenter.ID)
fmt.Printf("ID:\t\t%d\n", datacenter.ID)
fmt.Printf("Name:\t\t%s\n", datacenter.Name)
fmt.Printf("Description:\t%s\n", datacenter.Description)
Expand Down

0 comments on commit b70dfe3

Please sign in to comment.