Humanize file sizes in gen output, clean up temp on signal

- Humanize file sizes in verbose file listing (e.g., "76.8 MiB" not "76836984 bytes")
- Add signal handler to clean up temp file on Ctrl-C/SIGTERM during gen
This commit is contained in:
2025-12-17 16:26:32 -08:00
parent 1d37dd9748
commit 07db5d434f
2 changed files with 20 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import (
"sync"
"time"
"github.com/dustin/go-humanize"
"github.com/spf13/afero"
"sneak.berlin/go/mfer/internal/log"
"sneak.berlin/go/mfer/mfer"
@@ -354,7 +355,7 @@ func (s *Scanner) ToManifest(ctx context.Context, w io.Writer, progress chan<- S
return err
}
log.Verbosef("+ %s (%d bytes)", entry.Path, bytesRead)
log.Verbosef("+ %s (%s)", entry.Path, humanize.IBytes(uint64(bytesRead)))
scannedFiles++
scannedBytes += bytesRead