diff options
author | Michael Muré <batolettre@gmail.com> | 2023-01-10 21:36:03 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2023-01-11 14:31:22 +0100 |
commit | 7df34aa7a40be0d7b759ea3ef42cedf9f25f32b2 (patch) | |
tree | a3d1cc77f56814d4ec8838f18cb6768035c1b290 /entities/identity | |
parent | 9c50a359704f4edd2f33df6d256e032feae3a576 (diff) | |
download | git-bug-7df34aa7a40be0d7b759ea3ef42cedf9f25f32b2.tar.gz |
commands: add a nice terminal progress bar when building the cache
One issue remaining is that writing the cache takes significant time, but I don't know how to reflect that nicely to the user.
Diffstat (limited to 'entities/identity')
-rw-r--r-- | entities/identity/identity.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/entities/identity/identity.go b/entities/identity/identity.go index 22ce652c..e654cb2b 100644 --- a/entities/identity/identity.go +++ b/entities/identity/identity.go @@ -238,6 +238,9 @@ func readAll(repo repository.ClockedRepo, refPrefix string) <-chan entity.Stream return } + total := int64(len(refs)) + current := int64(1) + for _, ref := range refs { i, err := read(repo, ref) @@ -246,7 +249,12 @@ func readAll(repo repository.ClockedRepo, refPrefix string) <-chan entity.Stream return } - out <- entity.StreamedEntity[*Identity]{Entity: i} + out <- entity.StreamedEntity[*Identity]{ + Entity: i, + CurrentEntity: current, + TotalEntities: total, + } + current++ } }() |