diff --git a/internal/hardware/retrieve.go b/internal/hardware/retrieve.go index 3c3588a9..d8fd228a 100644 --- a/internal/hardware/retrieve.go +++ b/internal/hardware/retrieve.go @@ -44,9 +44,9 @@ func (c *Client) Retrieve() *cobra.Command { projectID, _ := cmd.Flags().GetString("project-id") hardwareReservationID, _ := cmd.Flags().GetString("id") - header := []string{"ID", "Facility", "Plan", "Created"} + header := []string{"ID", "Facility", "Metro", "Plan", "Created"} - inc := []string{} + inc := []string{"facility"} // only fetch extra details when rendered switch c.Servicer.Format() { @@ -69,8 +69,12 @@ func (c *Client) Retrieve() *cobra.Command { } data := make([][]string, 1) + metro := "" + if r.Facility.Metro != nil { + metro = r.Facility.Metro.Code + } - data[0] = []string{r.ID, r.Facility.Code, r.Plan.Name, r.CreatedAt.String()} + data[0] = []string{r.ID, r.Facility.Code, metro, r.Plan.Name, r.CreatedAt.String()} return c.Out.Output(r, header, &data) } @@ -83,7 +87,11 @@ func (c *Client) Retrieve() *cobra.Command { data := make([][]string, len(reservations)) for i, r := range reservations { - data[i] = []string{r.ID, r.Facility.Code, r.Plan.Name, r.CreatedAt.String()} + metro := "" + if r.Facility.Metro != nil { + metro = r.Facility.Metro.Code + } + data[i] = []string{r.ID, r.Facility.Code, metro, r.Plan.Name, r.CreatedAt.String()} } return c.Out.Output(reservations, header, &data)