X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/bd7da3557dc7a17020931f5a49ed5007fa81a645..HEAD:/command.go diff --git a/command.go b/command.go index 02901e2..8b5f29e 100644 --- a/command.go +++ b/command.go @@ -19,6 +19,8 @@ Commands: import WhatsApp history (stop the daemon first) -n print the plan without model calls --agent NAME import into an existing direct child (default: root) + notify [--agent-id ID] --source SOURCE --id ID --text TEXT + send an external event (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 @@ -54,15 +56,47 @@ func parseCommand(ctx context.Context, args []string) error { // 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) + err := daemon(ctx, os.Stdout) + if err != nil { + return fmt.Errorf("run daemon: %w", err) + } + + return nil case len(args) == 0 || len(args) == 1 && args[0] == "chat": - return terminal(ctx, os.Stdin, os.Stdout) + err := terminal(ctx, os.Stdin, os.Stdout) + if err != nil { + return fmt.Errorf("run terminal: %w", err) + } + + return nil case len(args) == 2 && args[0] == "backup": - return backup(ctx, args[1], os.Stdout) + err := backup(ctx, args[1], os.Stdout) + if err != nil { + return fmt.Errorf("run backup: %w", err) + } + + return nil case len(args) == 2 && args[0] == "restore": - return restore(ctx, args[1], os.Stdout) + err := restore(ctx, args[1], os.Stdout) + if err != nil { + return fmt.Errorf("run restore: %w", err) + } + + return nil + case len(args) > 0 && args[0] == "notify": + err := notify(ctx, args[1:], os.Stdout) + if err != nil { + return fmt.Errorf("submit external event: %w", err) + } + + return nil case len(args) > 0 && args[0] == "import": - return whatsappImport(ctx, args[1:], os.Stdout) + err := whatsappImport(ctx, args[1:], os.Stdout) + if err != nil { + return fmt.Errorf("import WhatsApp history: %w", err) + } + + return nil case len(args) > 0 && args[0] == "probe": err := probe(ctx, args[1:], os.Stdout) if err != nil {