Skip to content

Commit

Permalink
fix(router): show full API response in marshaled outputs after filter (
Browse files Browse the repository at this point in the history
  • Loading branch information
villevsv-upcloud authored Oct 16, 2023
1 parent 3eb94a9 commit 1b09bb4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
18 changes: 11 additions & 7 deletions internal/commands/router/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
5 changes: 4 additions & 1 deletion internal/commands/router/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1b09bb4

Please sign in to comment.