]> git.giacomolli.uk - onechat/blobdiff - main.go
Give the rebuild its own call limit
[onechat] / main.go
diff --git a/main.go b/main.go
index 04b06770977eac566ca0599a0766f4864b095bbb..9c1c8b92f7abf6c301ad4a64c849b623838a13e7 100644 (file)
--- a/main.go
+++ b/main.go
@@ -1,3 +1,4 @@
+// Command onechat runs the agent daemon and its terminal client.
 package main
 
 import (
@@ -15,6 +16,8 @@ const usage = `Usage: onechat [COMMAND]
 Commands:
   chat                     talk to the agent in this terminal (default)
   daemon                   run the agent, Telegram, and WhatsApp
+  import [-n] ZIP...        import WhatsApp history (stop the daemon first)
+    -n                     print the plan without model calls
   login                    log in to ChatGPT with a device code
   probe LOG COUNT [BUILDS] measure the compactor on a log, with real calls
   help                     show this help
@@ -39,19 +42,22 @@ func run() error {
        case len(args) == 1 && (args[0] == "help" || args[0] == "--help" || args[0] == "-h"):
                _, err := fmt.Print(usage)
                if err != nil {
-                       return err
+                       return fmt.Errorf("write command help: %w", err)
                }
        case len(args) == 1 && args[0] == "login":
                err := chatgptLogin(ctx, os.Stdout)
                if err != nil {
                        return err
                }
+
        // A signal is the normal stop of the daemon and the client, so their
        // result does not include ctx.Err().
        case len(args) == 1 && args[0] == "daemon":
                return daemon(ctx, os.Stdout)
        case len(args) == 0 || len(args) == 1 && args[0] == "chat":
                return terminal(ctx, os.Stdin, os.Stdout)
+       case len(args) > 0 && args[0] == "import":
+               return whatsappImport(ctx, args[1:], os.Stdout)
        case len(args) > 0 && args[0] == "probe":
                err := probe(ctx, args[1:], os.Stdout)
                if err != nil {