feat(cli): add read-only list and show subcommands
tapir list — table of stored summaries (date, title|id, channel, AI, fallback), recent-first. tapir show <video-id> — full summary with highlights and takeaways. DSN + user id from TAPIR_DB_DSN/TAPIR_USER_ID, never hardcoded. main.go gains a minimal os.Args[1] dispatcher kept flat so Worker F's auth/run cases union cleanly at merge. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+36
-5
@@ -1,10 +1,41 @@
|
||||
// Command tapir is the service entrypoint. Scaffold: it identifies itself so
|
||||
// the CI smoke test has something to grep for, and exits. Wiring the HTTP
|
||||
// server, watcher, adapters, and config is part of the build.
|
||||
// Command tapir is the service entrypoint and CLI. Subcommands are dispatched off
|
||||
// os.Args[1]; each lives in its own file (list.go, show.go, …). The switch is kept
|
||||
// deliberately flat so concurrently-added subcommands union cleanly.
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("tapir: scaffold — not yet implemented")
|
||||
if len(os.Args) < 2 {
|
||||
usage()
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
var err error
|
||||
switch os.Args[1] {
|
||||
case "list":
|
||||
err = runList(ctx, os.Args[2:])
|
||||
case "show":
|
||||
err = runShow(ctx, os.Args[2:])
|
||||
default:
|
||||
usage()
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "tapir:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func usage() {
|
||||
fmt.Fprintln(os.Stderr, "usage: tapir <command> [args]")
|
||||
fmt.Fprintln(os.Stderr, "commands:")
|
||||
fmt.Fprintln(os.Stderr, " list [-limit N] list stored summaries, recent first")
|
||||
fmt.Fprintln(os.Stderr, " show <video-id> show one summary in full")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user