Indent snapshot summary details; add Finished message; fix 'to process'
- New ui.Detail method for indented continuation lines under a preceding Complete (visually same as Progress: " 》" in white). - Snapshot summary lines (Files/Data/Storage/Upload/Duration) are now Detail lines indented under "Created snapshot X.". - Local index database prune complete result lines (incomplete snapshots, orphaned files/chunks/blobs) are also Detail lines under a clean Complete header. - "Files: ... to process" → "Files: ... processed" (they have been processed by the time we emit the summary). - "Data: ... (... to process)" → "Data: ... (... processed)". - ui.Writer now tracks warning and error counts emitted; Vaultik prints "Finished successfully." or "Finished (with N warnings)." as the final line of CreateSnapshot.
This commit is contained in:
@@ -92,6 +92,12 @@ func (v *Vaultik) CreateSnapshot(opts *SnapshotCreateOptions) error {
|
||||
}
|
||||
}
|
||||
|
||||
if v.UI.WarningCount() > 0 {
|
||||
v.UI.Complete("Finished (with %d warnings).", v.UI.WarningCount())
|
||||
} else {
|
||||
v.UI.Complete("Finished successfully.")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -336,35 +342,35 @@ func (v *Vaultik) printSnapshotSummary(snapshotID string, startTime time.Time, s
|
||||
}
|
||||
|
||||
v.UI.Complete("Created snapshot %s.", v.UI.Snapshot(snapshotID))
|
||||
filesMsg := fmt.Sprintf("Files: %s examined, %s to process, %s unchanged",
|
||||
filesMsg := fmt.Sprintf("Files: %s examined, %s processed, %s unchanged",
|
||||
v.UI.Count(stats.totalFiles),
|
||||
v.UI.Count(totalFilesChanged),
|
||||
v.UI.Count(stats.totalFilesSkipped))
|
||||
if stats.totalFilesDeleted > 0 {
|
||||
filesMsg += fmt.Sprintf(", %s deleted", v.UI.Count(stats.totalFilesDeleted))
|
||||
}
|
||||
v.UI.Info("%s.", filesMsg)
|
||||
v.UI.Detail("%s.", filesMsg)
|
||||
|
||||
dataMsg := fmt.Sprintf("Data: %s total (%s to process)",
|
||||
dataMsg := fmt.Sprintf("Data: %s total (%s processed)",
|
||||
v.UI.Size(totalBytesAll),
|
||||
v.UI.Size(stats.totalBytes))
|
||||
if stats.totalBytesDeleted > 0 {
|
||||
dataMsg += fmt.Sprintf(", %s deleted", v.UI.Size(stats.totalBytesDeleted))
|
||||
}
|
||||
v.UI.Info("%s.", dataMsg)
|
||||
v.UI.Detail("%s.", dataMsg)
|
||||
|
||||
if stats.totalBlobsUploaded > 0 {
|
||||
v.UI.Info("Storage: %s compressed from %s (%.2fx ratio).",
|
||||
v.UI.Detail("Storage: %s compressed from %s (%.2fx ratio).",
|
||||
v.UI.Size(totalBlobSizeCompressed),
|
||||
v.UI.Size(totalBlobSizeUncompressed),
|
||||
compressionRatio)
|
||||
v.UI.Info("Upload: %d blobs, %s in %s (%s).",
|
||||
v.UI.Detail("Upload: %d blobs, %s in %s (%s).",
|
||||
stats.totalBlobsUploaded,
|
||||
v.UI.Size(stats.totalBytesUploaded),
|
||||
v.UI.Duration(stats.uploadDuration),
|
||||
formatUploadSpeed(stats.totalBytesUploaded, stats.uploadDuration))
|
||||
}
|
||||
v.UI.Info("Snapshot create duration: %s.", v.UI.Duration(snapshotDuration))
|
||||
v.UI.Detail("Snapshot create duration: %s.", v.UI.Duration(snapshotDuration))
|
||||
}
|
||||
|
||||
// getSnapshotBlobSizes returns total compressed and uncompressed blob sizes for a snapshot
|
||||
@@ -1333,11 +1339,11 @@ func (v *Vaultik) PruneDatabase() (*PruneResult, error) {
|
||||
)
|
||||
|
||||
snapshotCountAfter := snapshotCountBefore - result.SnapshotsDeleted
|
||||
v.UI.Complete("Pruned local index database: %d incomplete snapshots removed (%d remain), %d orphaned files removed (%d remain), %d orphaned chunks removed (%d remain), %d orphaned blobs removed (%d remain).",
|
||||
result.SnapshotsDeleted, snapshotCountAfter,
|
||||
result.FilesDeleted, fileCountAfter,
|
||||
result.ChunksDeleted, chunkCountAfter,
|
||||
result.BlobsDeleted, blobCountAfter)
|
||||
v.UI.Complete("Pruned local index database.")
|
||||
v.UI.Detail("Incomplete snapshots: %d removed (%d remain).", result.SnapshotsDeleted, snapshotCountAfter)
|
||||
v.UI.Detail("Orphaned files: %d removed (%d remain).", result.FilesDeleted, fileCountAfter)
|
||||
v.UI.Detail("Orphaned chunks: %d removed (%d remain).", result.ChunksDeleted, chunkCountAfter)
|
||||
v.UI.Detail("Orphaned blobs: %d removed (%d remain).", result.BlobsDeleted, blobCountAfter)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user