internal/pkg: cache flags
Some checks failed
Test / Create distribution (push) Successful in 1m25s
Test / Flake checks (push) Has been cancelled
Test / Sandbox (push) Has started running
Test / Sandbox (race detector) (push) Has been cancelled
Test / Hakurei (push) Has been cancelled
Test / Hakurei (race detector) (push) Has been cancelled
Test / ShareFS (push) Has been cancelled

This is cleaner for extending the API.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-04-03 16:10:50 +09:00
parent 5536d736a6
commit 660408745d
9 changed files with 55 additions and 120 deletions

View File

@@ -69,11 +69,10 @@ func main() {
}()
var (
flagQuiet bool
flagCures int
flagBase string
flagTShift int
flagIdle bool
flagQuiet bool
flagCures int
flagBase string
flagIdle bool
)
c := command.New(os.Stderr, log.Printf, "mbf", func([]string) (err error) {
msg.SwapVerbose(!flagQuiet)
@@ -89,16 +88,7 @@ func main() {
} else if base, err = check.NewAbs(flagBase); err != nil {
return
}
if cache, err = pkg.Open(ctx, msg, flagCures, base); err == nil {
if flagTShift < 0 {
cache.SetThreshold(0)
} else if flagTShift > 31 {
cache.SetThreshold(1 << 31)
} else {
cache.SetThreshold(1 << flagTShift)
}
}
cache, err = pkg.Open(ctx, msg, 0, flagCures, base)
if flagIdle {
pkg.SetSchedIdle = true
}
@@ -116,10 +106,6 @@ func main() {
&flagBase,
"d", command.StringFlag("$MBF_CACHE_DIR"),
"Directory to store cured artifacts",
).Flag(
&flagTShift,
"tshift", command.IntFlag(-1),
"Dependency graph size exponent, to the power of 2",
).Flag(
&flagIdle,
"sched-idle", command.BoolFlag(false),