diff options
author | Michael Muré <batolettre@gmail.com> | 2023-01-14 14:49:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-14 14:49:25 +0100 |
commit | 6e5ea512ac82972c6e0da78976f967006e5fe5c4 (patch) | |
tree | 7727fc721b4bd82fcf7869fb48f9656504cbb3af /entity/dag/entity.go | |
parent | a1eec9aadfa24bad4804edc5fbb1c0753f4690cb (diff) | |
parent | 7df34aa7a40be0d7b759ea3ef42cedf9f25f32b2 (diff) | |
download | git-bug-6e5ea512ac82972c6e0da78976f967006e5fe5c4.tar.gz |
Merge pull request #987 from MichaelMure/cache-progress-bar
commands: add a nice terminal progress bar when building the cache
Diffstat (limited to 'entity/dag/entity.go')
-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++ } }() |