Add --print-timeline-and-exit flag

This commit is contained in:
Ian Gulliver
2026-02-20 16:36:18 -07:00
parent 47ed09a848
commit 90ce4d93fa

View File

@@ -20,6 +20,7 @@ var staticFS embed.FS
func main() {
addr := flag.String("addr", ":8080", "listen address")
runAndExitStr := flag.String("run-and-exit", "", "command to run after server starts, then exit")
printTimeline := flag.Bool("print-timeline-and-exit", false, "print timeline JSON and exit")
flag.Parse()
var runAndExit []string
@@ -39,6 +40,16 @@ func main() {
os.Exit(1)
}
if *printTimeline {
enc := json.NewEncoder(os.Stdout)
enc.SetIndent("", " ")
if err := enc.Encode(timeline); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
return
}
sub, err := fs.Sub(staticFS, "static")
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)