diff options
| author | ewy <ewy0@protonmail.com> | 2026-05-17 01:37:24 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-05-17 01:37:24 +0200 |
| commit | f5807d9f3a6c96e70912b61fac17120f412b5782 (patch) | |
| tree | d6928795e06b1af000ffba2ae50bb6f8f7b72685 /main.go | |
| parent | 7984fd9beaa7c903288142818cb328c584a139a5 (diff) | |
* integration tests with a pik target to run them
* add abstraction for paths to facilitate unit tests
* flesh out completion (--install-completion)
* do sync init before stateless modes so list knows more
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -29,7 +29,7 @@ import ( // syncInitializers are ran before the initializers. // useful for initializing stuff like paths, preparing directories, and reading the environment var syncInitializers = ComponentList[model.Initializer]{ - paths.Paths, + paths.Component, cache.Init, } @@ -108,6 +108,10 @@ func mode[T any](list ModeMap[T], fire func(mode T) error) *int { func pik() int { pflag.Parse() + syncInitializers.RunSync(func(initializer model.Initializer) error { + return initializer.Init() + }) + code := mode(statelessModes, func(mode func() error) error { return mode() }) @@ -115,10 +119,6 @@ func pik() int { return *code } - syncInitializers.RunSync(func(initializer model.Initializer) error { - return initializer.Init() - }) - initializers.RunAsync(func(initializer model.Initializer) error { return initializer.Init() }) @@ -128,9 +128,9 @@ func pik() int { _, _ = spool.Warn("%v\n", err) return 1 } - locs := crawl.RichLocations(here) - last := locs[len(locs)-1] - root, err := os.OpenRoot(last) + locs := append(crawl.RichLocations(here), paths.System.String()) + root, err := os.OpenRoot("/") + defer root.Close() if root == nil { _, _ = spool.Warn("%v\n", err) return 1 @@ -150,14 +150,14 @@ func pik() int { if len(stateErrors) > 0 { return } - err := cache.Insert(st) + err := cache.MergeAndSave(st) if err != nil { - spool.Warn("%v\n", err) + _, _ = spool.Warn("%v\n", err) } }() } else { - c, err = cache.LoadFile(fs, cache.Path[1:]) + c, err = cache.LoadFile(fs, paths.ContextsFile.String()[1:]) if err != nil { _, _ = spool.Warn("%v\n", err) return 1 |
