-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
42 lines (38 loc) · 996 Bytes
/
main.go
File metadata and controls
42 lines (38 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"flag"
"fmt"
"os"
)
func main() {
if len(os.Args) < 2 {
usage()
os.Exit(1)
}
sub := os.Args[1]
switch sub {
case "analyze":
analyzeCmd(os.Args[2:])
case "gen-router":
genRouterCmd(os.Args[2:])
case "collect":
collectCmd(os.Args[2:])
case "help", "-h", "--help":
usage()
default:
fmt.Fprintf(os.Stderr, "unknown subcommand: %s\n", sub)
usage()
os.Exit(1)
}
}
func usage() {
fmt.Println("feedbuilder <subcommand> [flags]")
fmt.Println("\nSubcommands:")
fmt.Println(" collect Fetch follows (kind 3) and relay lists (kind 10002) into data dir")
fmt.Println(" analyze Parse 10002 JSONL, build maps, apply excludes, compute optimal and outbox sets")
fmt.Println(" gen-router Generate strfry router config from analysis outputs")
fmt.Println("\nUse '<subcommand> -h' for flags.")
}
func commonFlags(fs *flag.FlagSet) (dataDir *string) {
return fs.String("data-dir", "./relay_data", "path to data directory (inputs/outputs)")
}