-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
49 lines (40 loc) · 1.68 KB
/
Copy pathmain.go
File metadata and controls
49 lines (40 loc) · 1.68 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Code generated by go-tool-synthesizer (defgotool: borealis-controller). DO NOT EDIT.
// Command borealis-controller is a borealis-profiled Go tool generated by go-tool-synthesizer.
//
// It is the §4 three-line-tool shape: load → derive → theme → grammar → execute → exit.
// The entrypoint (borealis.Execute) is outermost; errs.Exit is the single exit funnel.
package main
import (
"context"
"github.com/pleme-io/borealis"
"github.com/pleme-io/borealis-controller/internal/app"
"github.com/pleme-io/cli-go/exit"
errs "github.com/pleme-io/errors-go"
logging "github.com/pleme-io/logging-go"
)
func main() {
// One funnel, at main: run() returns a typed error, errs.Exit reduces it to a
// deterministic exit code and terminates (BOREALIS §3.5).
errs.Exit(run(context.Background()))
}
// run is the worked section-4 shape.
func run(ctx context.Context) error {
// 1. config — loaded once via the canonical shikumi loader (Law 3).
cfg, err := app.LoadConfig(ctx)
if err != nil {
return app.ErrConfig(err)
}
// 2. logging — a pure function of the shikumi sub-struct (Law 3, §2.3).
log, err := logging.FromConfig(cfg.Logging)
if err != nil {
return app.ErrConfig(err)
}
// 3. theme — the resolved borealis token bundle, one name fleet-wide.
theme := borealis.Nord()
// 4. grammar — the typed cli-go App (single source of truth for parse + help).
root := app.New(cfg, log, theme)
// 5. entrypoint — borealis.Execute is ALWAYS outermost; its result is mapped
// through cli-go's exit adapter so usage/help sentinels become errors-go exit
// codes before the single errs.Exit funnel reduces them (BOREALIS §3.5).
return exit.Map(borealis.Execute(ctx, root))
}