-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathactor.go
More file actions
30 lines (26 loc) · 764 Bytes
/
Copy pathactor.go
File metadata and controls
30 lines (26 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package ui
import (
"context"
"zfs-file-history/internal/logging"
"zfs-file-history/internal/zfs"
"github.com/oklog/run"
"github.com/pterm/pterm"
)
// AddActor wires ZFS preload and UI lifecycle into the application run group.
func AddActor(g *run.Group, ctx context.Context, path string) {
g.Add(func() error {
logging.Info("Initializing ZFS data...")
zfs.RefreshZfsData()
logging.Info("Launching UI...")
application := CreateUi(path, true)
return application.Run()
}, func(err error) {
if err != nil {
logging.Warning("Error stopping UI: %s", err.Error())
pterm.Warning.Printfln("Error stopping UI: %s", err.Error())
} else {
logging.Debug("UI stopped.")
pterm.Debug.Printfln("Received SIGTERM signal, exiting...")
}
})
}