-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
43 lines (38 loc) · 761 Bytes
/
main.go
File metadata and controls
43 lines (38 loc) · 761 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
43
// (C) 2025 GoodData Corporation
package main
import (
_ "embed"
"fmt"
"goodmock/internal/pureproxy"
"goodmock/internal/record"
"goodmock/internal/replay"
"os"
"strings"
)
//go:embed VERSION
var version string
func main() {
for _, arg := range os.Args[1:] {
if arg == "-v" || arg == "--version" {
fmt.Print(strings.TrimSpace(version))
fmt.Println()
os.Exit(0)
}
}
// First arg is the mode (default: replay)
mode := "replay"
if len(os.Args) > 1 {
mode = os.Args[1]
}
switch mode {
case "replay":
replay.RunReplay()
case "record":
record.RunRecord()
case "proxy":
pureproxy.RunProxy()
default:
fmt.Fprintf(os.Stderr, "Unknown mode: %s\nUsage: goodmock <mode>\nModes: replay, record, proxy\n", mode)
os.Exit(1)
}
}