diff options
author | Michael Muré <batolettre@gmail.com> | 2022-12-22 00:48:00 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2022-12-22 00:48:00 +0100 |
commit | d65e8837aa7bb1a6abb6892b9f2664e1b7edb02e (patch) | |
tree | 331b05b689182b4d2bf43fd7cf92ca03b055bff0 /commands | |
parent | 9b98fc06489353053564b431ac0c0d73a5c55a56 (diff) | |
download | git-bug-d65e8837aa7bb1a6abb6892b9f2664e1b7edb02e.tar.gz |
cache: generic withSnapshot, some cleanup
Diffstat (limited to 'commands')
-rw-r--r-- | commands/execenv/env.go | 8 | ||||
-rw-r--r-- | commands/webui.go | 16 |
2 files changed, 19 insertions, 5 deletions
diff --git a/commands/execenv/env.go b/commands/execenv/env.go index 4b353279..0813ab7e 100644 --- a/commands/execenv/env.go +++ b/commands/execenv/env.go @@ -135,20 +135,20 @@ func LoadBackend(env *Env) func(*cobra.Command, []string) error { } if events != nil { - _, _ = fmt.Fprintln(os.Stderr, "Building cache... ") + env.Err.Println("Building cache... ") } for event := range events { if event.Err != nil { - _, _ = fmt.Fprintf(os.Stderr, "Cache building error [%s]: %v\n", event.Typename, event.Err) + env.Err.Printf("Cache building error [%s]: %v\n", event.Typename, event.Err) continue } switch event.Event { case cache.BuildEventStarted: - _, _ = fmt.Fprintf(os.Stderr, "[%s] started\n", event.Typename) + env.Err.Printf("[%s] started\n", event.Typename) case cache.BuildEventFinished: - _, _ = fmt.Fprintf(os.Stderr, "[%s] done\n", event.Typename) + env.Err.Printf("[%s] done\n", event.Typename) } } diff --git a/commands/webui.go b/commands/webui.go index e1e0fc2b..4f7a02b5 100644 --- a/commands/webui.go +++ b/commands/webui.go @@ -105,11 +105,25 @@ func runWebUI(env *execenv.Env, opts webUIOptions) error { } mrc := cache.NewMultiRepoCache() - _, _, err := mrc.RegisterDefaultRepository(env.Repo) + _, events, err := mrc.RegisterDefaultRepository(env.Repo) if err != nil { return err } + 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.BuildEventStarted: + env.Err.Printf("[%s] started\n", event.Typename) + case cache.BuildEventFinished: + env.Err.Printf("[%s] done\n", event.Typename) + } + } + var errOut io.Writer if opts.logErrors { errOut = env.Err |