Skip to content

Commit 86c0d02

Browse files
committed
remove rows type
1 parent 90412c7 commit 86c0d02

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

enterprise/cli/provisionerkeys.go

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ package cli
33
import (
44
"fmt"
55
"strings"
6-
"time"
76

8-
"github.com/google/uuid"
97
"golang.org/x/xerrors"
108

119
agpl "github.com/coder/coder/v2/cli"
@@ -77,34 +75,11 @@ func (r *RootCmd) provisionerKeysCreate() *serpent.Command {
7775
return cmd
7876
}
7977

80-
type provisionerKeysTableRow struct {
81-
// For json output:
82-
Key codersdk.ProvisionerKey `table:"-"`
83-
84-
// For table output:
85-
Name string `json:"-" table:"name,default_sort"`
86-
CreatedAt time.Time `json:"-" table:"created_at"`
87-
OrganizationID uuid.UUID `json:"-" table:"organization_id"`
88-
}
89-
90-
func provisionerKeysToRows(keys ...codersdk.ProvisionerKey) []provisionerKeysTableRow {
91-
rows := make([]provisionerKeysTableRow, 0, len(keys))
92-
for _, key := range keys {
93-
rows = append(rows, provisionerKeysTableRow{
94-
Name: key.Name,
95-
CreatedAt: key.CreatedAt,
96-
OrganizationID: key.OrganizationID,
97-
})
98-
}
99-
100-
return rows
101-
}
102-
10378
func (r *RootCmd) provisionerKeysList() *serpent.Command {
10479
var (
10580
orgContext = agpl.NewOrganizationContext()
10681
formatter = cliui.NewOutputFormatter(
107-
cliui.TableFormat([]provisionerKeysTableRow{}, nil),
82+
cliui.TableFormat([]codersdk.ProvisionerKey{}, nil),
10883
cliui.JSONFormat(),
10984
)
11085
)
@@ -136,8 +111,7 @@ func (r *RootCmd) provisionerKeysList() *serpent.Command {
136111
return nil
137112
}
138113

139-
rows := provisionerKeysToRows(keys...)
140-
out, err := formatter.Format(inv.Context(), rows)
114+
out, err := formatter.Format(inv.Context(), keys)
141115
if err != nil {
142116
return xerrors.Errorf("display provisioner keys: %w", err)
143117
}

0 commit comments

Comments
 (0)