Skip to content

Commit c7c839d

Browse files
committed
refactor: Rename view implementation to be specific to list subcommand
1 parent 4a99305 commit c7c839d

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

internal/command/views/workspace.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ func (v *WorkspaceJSON) List(current string, list []string, diags tfdiags.Diagno
9292

9393
// The WorkspaceHuman implementation renders human-readable text logs, suitable for
9494
// a scrolling terminal.
95+
//
96+
// This is currently not used, but is implemented here for when we remove use of
97+
// workspaceListHuman in the command package.
9598
type WorkspaceHuman struct {
9699
view *View
97100
}

internal/command/workspace_list.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ func (c *WorkspaceListCommand) Synopsis() string {
110110
return "List Workspaces"
111111
}
112112

113-
type workspaceHuman struct {
113+
type workspaceListHuman struct {
114114
ui cli.Ui
115115
meta *Meta
116116
}
117117

118118
// List is used to assemble the list of Workspaces and log it via Output
119-
func (v *workspaceHuman) List(selected string, list []string, diags tfdiags.Diagnostics) {
119+
func (v *workspaceListHuman) List(selected string, list []string, diags tfdiags.Diagnostics) {
120120
// Print diags above output
121121
v.meta.showDiagnostics(diags)
122122

@@ -135,16 +135,16 @@ func (v *workspaceHuman) List(selected string, list []string, diags tfdiags.Diag
135135
}
136136
}
137137

138-
// newWorkspace returns a views.Workspace interface.
138+
// newWorkspaceList returns a views.WorkspaceList interface.
139139
//
140140
// When human-readable output is migrated from cli.Ui to views.View this method should be deleted and
141-
// replaced with using views.NewWorkspace directly.
141+
// replaced with using views.NewWorkspaceList directly.
142142
func newWorkspaceList(vt arguments.ViewType, view *views.View, ui cli.Ui, meta *Meta) views.WorkspaceList {
143143
switch vt {
144144
case arguments.ViewJSON:
145145
return views.NewWorkspaceList(vt, view)
146146
case arguments.ViewHuman:
147-
return &workspaceHuman{
147+
return &workspaceListHuman{
148148
ui: ui,
149149
meta: meta,
150150
}

0 commit comments

Comments
 (0)