@@ -3,9 +3,7 @@ package cli
3
3
import (
4
4
"fmt"
5
5
"strings"
6
- "time"
7
6
8
- "github.com/google/uuid"
9
7
"golang.org/x/xerrors"
10
8
11
9
agpl "github.com/coder/coder/v2/cli"
@@ -77,34 +75,11 @@ func (r *RootCmd) provisionerKeysCreate() *serpent.Command {
77
75
return cmd
78
76
}
79
77
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
-
103
78
func (r * RootCmd ) provisionerKeysList () * serpent.Command {
104
79
var (
105
80
orgContext = agpl .NewOrganizationContext ()
106
81
formatter = cliui .NewOutputFormatter (
107
- cliui .TableFormat ([]provisionerKeysTableRow {}, nil ),
82
+ cliui .TableFormat ([]codersdk. ProvisionerKey {}, nil ),
108
83
cliui .JSONFormat (),
109
84
)
110
85
)
@@ -136,8 +111,7 @@ func (r *RootCmd) provisionerKeysList() *serpent.Command {
136
111
return nil
137
112
}
138
113
139
- rows := provisionerKeysToRows (keys ... )
140
- out , err := formatter .Format (inv .Context (), rows )
114
+ out , err := formatter .Format (inv .Context (), keys )
141
115
if err != nil {
142
116
return xerrors .Errorf ("display provisioner keys: %w" , err )
143
117
}
0 commit comments