From 59288d42a930b27d4e3e867182aaadd90054855d Mon Sep 17 00:00:00 2001 From: Thushan Fernando Date: Sat, 16 Dec 2023 13:26:02 +1100 Subject: [PATCH] displays duplicate space. --- internal/smash/formatter.go | 9 ++++++++- internal/theme/style.go | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/smash/formatter.go b/internal/smash/formatter.go index c6b7b28..3bfebea 100644 --- a/internal/smash/formatter.go +++ b/internal/smash/formatter.go @@ -62,7 +62,14 @@ func displayFiles(files []report.SmashFile) { if duplicateFiles != 0 { root := files[0] dupes := files[1:] - theme.Println(theme.ColourFilename(root.Path), " ", theme.ColourFileSize(root.FileSizeF), " ", theme.ColourHash(root.Hash)) + var dupeSize string + if len(files) > 2 { + totalDupeSize := uint64(len(files)-1) * root.FileSize + dupeSize = "(" + theme.ColourFileSizeDupe(humanize.Bytes(totalDupeSize)) + ")" + } else { + dupeSize = " " + } + theme.Println(theme.ColourFilename(root.Path), " ", theme.ColourFileSize(root.FileSizeF), dupeSize, theme.ColourHash(root.Hash)) printSmashHits(dupes) } } diff --git a/internal/theme/style.go b/internal/theme/style.go index 404d28f..4f22734 100644 --- a/internal/theme/style.go +++ b/internal/theme/style.go @@ -124,6 +124,9 @@ func ColourFileSize(message ...any) string { func ColourFileSizeA(message ...any) string { return pterm.Cyan(message...) } +func ColourFileSizeDupe(message ...any) string { + return pterm.LightRed(message...) +} func ColourHash(message ...any) string { return pterm.Gray(message...) }