aboutsummaryrefslogtreecommitdiffstats
path: root/commands/webui.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2023-01-10 21:36:03 +0100
committerMichael Muré <batolettre@gmail.com>2023-01-11 14:31:22 +0100
commit7df34aa7a40be0d7b759ea3ef42cedf9f25f32b2 (patch)
treea3d1cc77f56814d4ec8838f18cb6768035c1b290 /commands/webui.go
parent9c50a359704f4edd2f33df6d256e032feae3a576 (diff)
downloadgit-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 'commands/webui.go')
-rw-r--r--commands/webui.go17
1 files changed, 4 insertions, 13 deletions
diff --git a/commands/webui.go b/commands/webui.go
index 0b3b24a6..31313146 100644
--- a/commands/webui.go
+++ b/commands/webui.go
@@ -108,19 +108,10 @@ func runWebUI(env *execenv.Env, opts webUIOptions) error {
mrc := cache.NewMultiRepoCache()
_, events := mrc.RegisterDefaultRepository(env.Repo)
- for event := range events {
- if event.Err != nil {
- env.Err.Printf("Cache building error [%s]: %v\n", event.Typename, event.Err)
- continue
- }
- switch event.Event {
- case cache.BuildEventCacheIsBuilt:
- env.Err.Println("Building cache... ")
- case cache.BuildEventStarted:
- env.Err.Printf("[%s] started\n", event.Typename)
- case cache.BuildEventFinished:
- env.Err.Printf("[%s] done\n", event.Typename)
- }
+
+ err := execenv.CacheBuildProgressBar(env, events)
+ if err != nil {
+ return err
}
var errOut io.Writer