(ctx context.Context, m *snapshot.Manifest, ent fs.Entry, lastTotalFileSize int64)
| 385 | } |
| 386 | |
| 387 | func (c *commandSnapshotList) entryBits(ctx context.Context, m *snapshot.Manifest, ent fs.Entry, lastTotalFileSize int64) (bits []string, col *color.Color) { |
| 388 | col = color.New() // default color |
| 389 | |
| 390 | if m.IncompleteReason != "" { |
| 391 | bits = append(bits, "incomplete:"+m.IncompleteReason) |
| 392 | } |
| 393 | |
| 394 | var summary *fs.DirectorySummary |
| 395 | |
| 396 | if dws, ok := ent.(fs.DirectoryWithSummary); ok { |
| 397 | s, err := dws.Summary(ctx) |
| 398 | if err != nil { |
| 399 | log(ctx).Warnw("unable to get directory summary", "name", ent.Name(), "err", err) |
| 400 | } |
| 401 | |
| 402 | summary = s |
| 403 | } |
| 404 | |
| 405 | totalBytes := ent.Size() |
| 406 | if summary != nil { |
| 407 | totalBytes = summary.TotalFileSize |
| 408 | } |
| 409 | |
| 410 | bits = append(bits, |
| 411 | maybeHumanReadableBytes(c.snapshotListShowHumanReadable, totalBytes), |
| 412 | ent.Mode().String()) |
| 413 | if c.snapshotListShowOwner { |
| 414 | bits = append(bits, |
| 415 | fmt.Sprintf("uid:%v", ent.Owner().UserID), |
| 416 | fmt.Sprintf("gid:%v", ent.Owner().GroupID)) |
| 417 | } |
| 418 | |
| 419 | if c.snapshotListShowModTime { |
| 420 | bits = append(bits, fmt.Sprintf("modified:%v", formatTimestamp(ent.ModTime()))) |
| 421 | } |
| 422 | |
| 423 | if c.snapshotListShowItemID { |
| 424 | bits = append(bits, "manifest:"+string(m.ID)) |
| 425 | } |
| 426 | |
| 427 | if c.snapshotListShowDelta { |
| 428 | bits = append(bits, deltaBytes(ent.Size()-lastTotalFileSize)) |
| 429 | } |
| 430 | |
| 431 | if summary != nil { |
| 432 | bits = append(bits, |
| 433 | fmt.Sprintf("files:%v", summary.TotalFileCount), |
| 434 | fmt.Sprintf("dirs:%v", summary.TotalDirCount)) |
| 435 | if summary.FatalErrorCount > 0 { |
| 436 | bits = append(bits, fmt.Sprintf("errors:%v", summary.FatalErrorCount)) |
| 437 | col = errorColor |
| 438 | } |
| 439 | } |
| 440 | |
| 441 | if u := m.StorageStats; u != nil { |
| 442 | bits = append(bits, |
| 443 | fmt.Sprintf("new-data:%v", units.BytesString(atomic.LoadInt64(&u.NewData.PackedContentBytes))), |
| 444 | fmt.Sprintf("new-files:%v", atomic.LoadInt32(&u.NewData.FileObjectCount)), |
no test coverage detected