Skip to content

Commit

Permalink
incus/snapshot: Fix format handling in list
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Jan 2, 2024
1 parent e1d3c40 commit ed0d0ab
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions cmd/incus/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,8 @@ func (c *cmdSnapshotList) listSnapshots(d incus.InstanceServer, name string) err
const layout = "2006/01/02 15:04 MST"

// List snapshots
firstSnapshot := true
snapData := [][]string{}

for _, snap := range snapshots {
if firstSnapshot {
fmt.Println("\n" + i18n.G("Snapshots:"))
}

var row []string

fields := strings.Split(snap.Name, instance.SnapshotDelimiter)
Expand All @@ -316,7 +310,6 @@ func (c *cmdSnapshotList) listSnapshots(d incus.InstanceServer, name string) err
row = append(row, "NO")
}

firstSnapshot = false
snapData = append(snapData, row)
}

Expand All @@ -327,7 +320,7 @@ func (c *cmdSnapshotList) listSnapshots(d incus.InstanceServer, name string) err
i18n.G("Stateful"),
}

_ = cli.RenderTable(cli.TableFormatTable, snapHeader, snapData, snapshots)
_ = cli.RenderTable(c.flagFormat, snapHeader, snapData, snapshots)

return nil
}
Expand Down

0 comments on commit ed0d0ab

Please sign in to comment.