From 589d50d95019638ca394382cbc6b21c6b248888d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 2 Sep 2025 15:18:27 -0500 Subject: [PATCH] convert is working okay --- argv.go | 6 +++++- doClean.go | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/argv.go b/argv.go index 58a94e0..d6d2357 100644 --- a/argv.go +++ b/argv.go @@ -16,7 +16,7 @@ type args struct { Interact *EmptyCmd `arg:"subcommand:interact" help:"open env EDITOR"` Playback *PlaybackCmd `arg:"subcommand:playback" help:"dump your prior conversations to the terminal'"` NewChat *PlaybackCmd `arg:"subcommand:newchat" help:"used by gemini-cli on startup"` - Clean *EmptyCmd `arg:"subcommand:clean" help:"cleanup the files in /tmp"` + Clean *CleanCmd `arg:"subcommand:clean" help:"cleanup the files in /tmp"` Stats string `arg:"--stats" help:"add stats to a chat"` Force bool `arg:"--force" help:"try to strong arm things"` Verbose bool `arg:"--verbose" help:"show more output"` @@ -27,6 +27,10 @@ type args struct { type EmptyCmd struct { } +type CleanCmd struct { + Match string `arg:"positional"` +} + type PlaybackCmd struct { Last *EmptyCmd `arg:"subcommand:last" help:"dump the last one"` List *EmptyCmd `arg:"subcommand:list" help:"list memories"` diff --git a/doClean.go b/doClean.go index c30aee7..d5d2e86 100644 --- a/doClean.go +++ b/doClean.go @@ -36,7 +36,7 @@ func scanTmp() { if !strings.HasPrefix(fname, "regex.") { return nil } - if count > 5 { + if count > 10 { return log.Errorf("count exceeded") } if strings.HasPrefix(fname, "regex.gemini-api-response") { @@ -87,6 +87,11 @@ func cleanGeminiFile(fullname string) error { return log.Errorf("parsePB() == nil") } uuid := parts[1] + if argv.Clean.Match != "" { + if !strings.HasPrefix(uuid, argv.Clean.Match) { + return log.Errorf("uuid %s does not match %s", uuid, argv.Clean.Match) + } + } if chat := me.chats.FindUuid(uuid); chat != nil { log.Info("found uuid in chat", uuid, pb.Model, chat.Uuid) statf, err := os.Stat(fullname) @@ -94,7 +99,6 @@ func cleanGeminiFile(fullname string) error { age := statf.ModTime() if chat.AddGeminiRequest(fname, age, pb) { me.chats.ConfigSave() - okExit("") } else { log.Info("file was perfect. os.Remove() here", fullname) os.Remove(fullname)