in cmd/iceberg/output.go [113:163]
func (t textOutput) Files(tbl *table.Table, history bool) {
var snapshots []table.Snapshot
if history {
snapshots = tbl.Metadata().Snapshots()
} else {
snap := tbl.CurrentSnapshot()
if snap != nil {
snapshots = []table.Snapshot{*snap}
}
}
snapshotTree := pterm.LeveledList{}
for _, snap := range snapshots {
manifest := snap.ManifestList
if manifest != "" {
manifest = ": " + manifest
}
snapshotTree = append(snapshotTree, pterm.LeveledListItem{
Level: 0,
Text: fmt.Sprintf("Snapshot %d, schema %d%s",
snap.SnapshotID, *snap.SchemaID, manifest),
})
manifestList, err := snap.Manifests(tbl.FS())
if err != nil {
t.Error(err)
os.Exit(1)
}
for _, m := range manifestList {
snapshotTree = append(snapshotTree, pterm.LeveledListItem{
Level: 1, Text: "Manifest: " + m.FilePath(),
})
datafiles, err := m.FetchEntries(tbl.FS(), false)
if err != nil {
t.Error(err)
os.Exit(1)
}
for _, e := range datafiles {
snapshotTree = append(snapshotTree, pterm.LeveledListItem{
Level: 2, Text: "Datafile: " + e.DataFile().FilePath(),
})
}
}
}
node := putils.TreeFromLeveledList(snapshotTree)
node.Text = "Snapshots: " + strings.Join(tbl.Identifier(), ".")
pterm.DefaultTree.WithRoot(node).Render()
}