feat: keep what was loaded between runs, and start where you left off

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kebandClaude Opus 5.5 committed 2026-10-11 09:32:55 +02:00
1 parent 6fab41703e
commit d6c4b33d1d
11 files changed
+506 -13

No files matched your search

+21 -1
View File
@@ -334,6 +334,21 @@ Flags:
onActive = srv.Touch
}
// What was loaded last time, and where it was left in this folder.
var cacheFile, placeDir string
if !*demo {
if d, err := config.CacheDir(); err == nil && config.On(cfg.Cache) {
cacheFile = filepath.Join(d, "cache.json")
}
placeDir = *dir
if placeDir == "" {
placeDir, _ = os.Getwd()
}
if abs, err := filepath.Abs(placeDir); err == nil {
placeDir = abs
}
}
m := app.New(providers, app.Options{
Timeout: *timeout,
Icons: *icons,
@@ -353,11 +368,16 @@ Flags:
Commands: cfg.CustomCommands,
Version: versionString(),
Store: st,
CacheFile: cacheFile,
Dir: placeDir,
Open: open,
Styles: &theme,
DefaultFg: defaultFg,
})
p = tea.NewProgram(m)
_, err = p.Run()
final, err := p.Run()
if fm, ok := final.(app.Model); ok {
_ = fm.Persist() // a cache it couldn't save is no reason to fail
}
return err
}