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 /entity/dag | |
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 'entity/dag')
-rw-r--r-- | entity/dag/entity.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/entity/dag/entity.go b/entity/dag/entity.go index 2028e1b4..f8dbd53d 100644 --- a/entity/dag/entity.go +++ b/entity/dag/entity.go @@ -314,6 +314,9 @@ func ReadAll[EntityT entity.Interface](def Definition, wrapper func(e *Entity) E return } + total := int64(len(refs)) + current := int64(1) + for _, ref := range refs { e, err := read[EntityT](def, wrapper, repo, resolvers, ref) @@ -322,7 +325,12 @@ func ReadAll[EntityT entity.Interface](def Definition, wrapper func(e *Entity) E return } - out <- entity.StreamedEntity[EntityT]{Entity: e} + out <- entity.StreamedEntity[EntityT]{ + Entity: e, + CurrentEntity: current, + TotalEntities: total, + } + current++ } }() |