aboutsummaryrefslogtreecommitdiffstats
path: root/entity/dag
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2023-01-14 14:49:25 +0100
committerGitHub <noreply@github.com>2023-01-14 14:49:25 +0100
commit6e5ea512ac82972c6e0da78976f967006e5fe5c4 (patch)
tree7727fc721b4bd82fcf7869fb48f9656504cbb3af /entity/dag
parenta1eec9aadfa24bad4804edc5fbb1c0753f4690cb (diff)
parent7df34aa7a40be0d7b759ea3ef42cedf9f25f32b2 (diff)
downloadgit-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')
-rw-r--r--entity/dag/entity.go10
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++
}
}()