]> git.giacomolli.uk - onechat/blobdiff - main.go
Import WhatsApp history into a child
[onechat] / main.go
diff --git a/main.go b/main.go
index a73407f7c8457e973f0fb7731312a139acb7c3d2..843bf9016905ab9d80fc6958f812cb5bf6a0b5d9 100644 (file)
--- a/main.go
+++ b/main.go
@@ -14,10 +14,14 @@ import (
 const usage = `Usage: onechat [COMMAND]
 
 Commands:
 const usage = `Usage: onechat [COMMAND]
 
 Commands:
+  backup FILE              archive the running daemon data
+  restore FILE             restore into an empty data directory
   chat                     talk to the agent in this terminal (default)
   daemon                   run the agent, Telegram, and WhatsApp
   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)
+  import [-n] [--agent NAME] ZIP...
+                           import WhatsApp history (stop the daemon first)
     -n                     print the plan without model calls
     -n                     print the plan without model calls
+    --agent NAME           import into an existing direct child (default: root)
   login                    log in to ChatGPT with a device code
   probe LOG COUNT [BUILDS] measure the compactor on a log, with real calls
   version                  show the build version
   login                    log in to ChatGPT with a device code
   probe LOG COUNT [BUILDS] measure the compactor on a log, with real calls
   version                  show the build version
@@ -65,6 +69,10 @@ func run() error {
                return daemon(ctx, os.Stdout)
        case len(args) == 0 || len(args) == 1 && args[0] == "chat":
                return terminal(ctx, os.Stdin, os.Stdout)
                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) == 2 && args[0] == "backup":
+               return backup(ctx, args[1], os.Stdout)
+       case len(args) == 2 && args[0] == "restore":
+               return restore(ctx, args[1], os.Stdout)
        case len(args) > 0 && args[0] == "import":
                return whatsappImport(ctx, args[1:], os.Stdout)
        case len(args) > 0 && args[0] == "probe":
        case len(args) > 0 && args[0] == "import":
                return whatsappImport(ctx, args[1:], os.Stdout)
        case len(args) > 0 && args[0] == "probe":