Skip to content

Commit c9dc4a1

Browse files
authored
feat(server): list devices in show output (#474)
1 parent c513b34 commit c9dc4a1

4 files changed

Lines changed: 32 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- stack destroy command for supabase, dokku and starter-kit
13+
- Add devices list to `server show` output.
1314

1415
## [3.24.1] - 2025-10-14
1516

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
dario.cat/mergo v1.0.2
77
github.com/UpCloudLtd/progress v1.0.3
88
github.com/UpCloudLtd/upcloud-go-api/credentials v0.1.1
9-
github.com/UpCloudLtd/upcloud-go-api/v8 v8.28.0
9+
github.com/UpCloudLtd/upcloud-go-api/v8 v8.30.0
1010
github.com/adrg/xdg v0.5.3
1111
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
1212
github.com/gemalto/flume v1.0.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,8 @@ github.com/UpCloudLtd/progress v1.0.3 h1:8SfntHkBPyQc5BL3946Bgi9KYnQOxa5RR2EKdad
423423
github.com/UpCloudLtd/progress v1.0.3/go.mod h1:iGxOnb9HvHW0yrLGUjHr0lxHhn7TehgWwh7a8NqK6iQ=
424424
github.com/UpCloudLtd/upcloud-go-api/credentials v0.1.1 h1:eTfQsv58ufALOk9BZ7WbS/i7pMUD11RnYYpRPsz0LdI=
425425
github.com/UpCloudLtd/upcloud-go-api/credentials v0.1.1/go.mod h1:7OtVs2UqtfvjkC1HfE+Oud0MnbMv7qUWnbEgxnTAqts=
426-
github.com/UpCloudLtd/upcloud-go-api/v8 v8.28.0 h1:51v7vnzSlTtEHP7lzyudLRgEQqd53+SADCrUaSX/Zdg=
427-
github.com/UpCloudLtd/upcloud-go-api/v8 v8.28.0/go.mod h1:NBh1d/ip1bhdAIhuPWbyPme7tbLzDTV7dhutUmU1vg8=
426+
github.com/UpCloudLtd/upcloud-go-api/v8 v8.30.0 h1:zdiwpkJ6S8kY6nJknkgD/uhKYgi3TTocZuqQ1ocnKoE=
427+
github.com/UpCloudLtd/upcloud-go-api/v8 v8.30.0/go.mod h1:NBh1d/ip1bhdAIhuPWbyPme7tbLzDTV7dhutUmU1vg8=
428428
github.com/adrg/xdg v0.5.3 h1:xRnxJXne7+oWDatRhR1JLnvuccuIeCoBu2rtuLqQB78=
429429
github.com/adrg/xdg v0.5.3/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ=
430430
github.com/ansel1/merry v1.5.0/go.mod h1:wUy/yW0JX0ix9GYvUbciq+bi3jW/vlKPlbpI7qdZpOw=

internal/commands/server/show.go

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,33 @@ func (s *showCommand) Execute(exec commands.Executor, uuid string) (output.Outpu
143143
},
144144
},
145145
labels.GetLabelsSection(server.Labels),
146+
}
147+
148+
if len(server.Devices) > 0 {
149+
deviceRows := []output.TableRow{}
150+
for _, device := range server.Devices {
151+
deviceRows = append(deviceRows, output.TableRow{
152+
device.Type,
153+
device.Model,
154+
device.Serial,
155+
})
156+
}
157+
158+
combined = append(combined, output.CombinedSection{
159+
Key: "devices",
160+
Title: "Devices:",
161+
Contents: output.Table{
162+
Columns: []output.TableColumn{
163+
{Key: "type", Header: "Type"},
164+
{Key: "model", Header: "Model"},
165+
{Key: "serial", Header: "Serial", Colour: ui.DefaultUUUIDColours},
166+
},
167+
Rows: deviceRows,
168+
},
169+
})
170+
}
171+
172+
combined = append(combined,
146173
output.CombinedSection{
147174
Key: "storage",
148175
Title: "Storage: (Flags: B = bootdisk, P = part of plan)",
@@ -174,7 +201,7 @@ func (s *showCommand) Execute(exec commands.Executor, uuid string) (output.Outpu
174201
Rows: nicRows,
175202
},
176203
},
177-
}
204+
)
178205

179206
// Firewall rules
180207
if server.Firewall == "on" {

0 commit comments

Comments
 (0)