| 56 | } |
| 57 | |
| 58 | func (c *commandList) listDirectory(ctx context.Context, d fs.Directory, prefix, indent string) error { |
| 59 | iter, err := d.Iterate(ctx) |
| 60 | if err != nil { |
| 61 | return err //nolint:wrapcheck |
| 62 | } |
| 63 | defer iter.Close() |
| 64 | |
| 65 | e, err := iter.Next(ctx) |
| 66 | for e != nil { |
| 67 | if err2 := c.printDirectoryEntry(ctx, e, prefix, indent); err2 != nil { |
| 68 | return err2 |
| 69 | } |
| 70 | |
| 71 | e, err = iter.Next(ctx) |
| 72 | } |
| 73 | |
| 74 | if err != nil { |
| 75 | return err //nolint:wrapcheck |
| 76 | } |
| 77 | |
| 78 | if dws, ok := d.(fs.DirectoryWithSummary); ok && c.errorSummary { |
| 79 | if ds, _ := dws.Summary(ctx); ds != nil && ds.FatalErrorCount > 0 { |
| 80 | errorColor.Fprintf(c.out.stderr(), "\nNOTE: Encountered %v errors while snapshotting this directory:\n\n", ds.FatalErrorCount) //nolint:errcheck |
| 81 | |
| 82 | for _, e := range ds.FailedEntries { |
| 83 | errorColor.Fprintf(c.out.stderr(), "- Error in \"%v\": %v\n", e.EntryPath, e.Error) //nolint:errcheck |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | return nil |
| 89 | } |
| 90 | |
| 91 | func (c *commandList) printDirectoryEntry(ctx context.Context, e fs.Entry, prefix, indent string) error { |
| 92 | hoid, ok := e.(object.HasObjectID) |