From d5dccd746ec55c9d946c06e0d17b4f76115c3169 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 7 Feb 2015 17:05:49 +0100 Subject: [PATCH] Progress: Add convenience functions --- progress.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/progress.go b/progress.go index b33c0d9aa..2843477b5 100644 --- a/progress.go +++ b/progress.go @@ -82,6 +82,16 @@ func (p *Progress) Report(s Stat) { } } +// Report a file with the given size. +func (p *Progress) ReportFile(size uint64) { + p.Report(Stat{Files: 1, Bytes: size}) +} + +// Report a directory. +func (p *Progress) ReportDir() { + p.Report(Stat{Dirs: 1}) +} + func (p *Progress) reporter() { if p == nil { return