diff --git a/internal/commands/router/list.go b/internal/commands/router/list.go index eb3dfc7cd..4e7da7412 100644 --- a/internal/commands/router/list.go +++ b/internal/commands/router/list.go @@ -50,7 +50,7 @@ func (s *listCommand) ExecuteWithoutArguments(exec commands.Executor) (output.Ou if s.serviceRouters.Value() { s.normalRouters = config.False } - var filtered []upcloud.Router + filtered := make([]upcloud.Router, 0) if s.allRouters.Value() { filtered = routers.Routers } else { @@ -67,12 +67,16 @@ func (s *listCommand) ExecuteWithoutArguments(exec commands.Executor) (output.Ou for i, router := range filtered { rows[i] = output.TableRow{router.UUID, router.Name, router.Type} } - return output.Table{ - Columns: []output.TableColumn{ - {Header: "UUID", Key: "uuid", Colour: ui.DefaultUUUIDColours}, - {Header: "Name", Key: "name"}, - {Header: "Type", Key: "type"}, + + return output.MarshaledWithHumanOutput{ + Value: filtered, + Output: output.Table{ + Columns: []output.TableColumn{ + {Header: "UUID", Key: "uuid", Colour: ui.DefaultUUUIDColours}, + {Header: "Name", Key: "name"}, + {Header: "Type", Key: "type"}, + }, + Rows: rows, }, - Rows: rows, }, nil } diff --git a/internal/commands/router/show.go b/internal/commands/router/show.go index 8c1a5e477..4e896c952 100644 --- a/internal/commands/router/show.go +++ b/internal/commands/router/show.go @@ -86,7 +86,10 @@ func (s *showCommand) Execute(exec commands.Executor, arg string) (output.Output }, } - return combined, nil + return output.MarshaledWithHumanOutput{ + Value: router, + Output: combined, + }, nil } func getNetworks(exec commands.Executor, attached upcloud.RouterNetworkSlice) ([]upcloud.Network, error) {