about summary refs log tree commit diff
path: root/tvix/nar-bridge/cmd/nar_bridge/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/nar-bridge/cmd/nar_bridge/main.go')
-rw-r--r--tvix/nar-bridge/cmd/nar_bridge/main.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/tvix/nar-bridge/cmd/nar_bridge/main.go b/tvix/nar-bridge/cmd/nar_bridge/main.go
new file mode 100644
index 000000000000..78ed3e272d69
--- /dev/null
+++ b/tvix/nar-bridge/cmd/nar_bridge/main.go
@@ -0,0 +1,30 @@
+package main
+
+import (
+	"os"
+
+	"github.com/alecthomas/kong"
+)
+
+//nolint:gochecknoglobals
+var cli struct {
+	// TODO: make log level configurable
+	Import ImportCmd `kong:"cmd,name='import',help='Import a local NAR file into a tvix-store'"`
+	Serve  ServeCmd  `kong:"cmd,name='serve',help='Expose a tvix-store RPC interface as NAR/NARInfo'"`
+}
+
+func main() {
+	parser, err := kong.New(&cli)
+	if err != nil {
+		panic(err)
+	}
+
+	ctx, err := parser.Parse(os.Args[1:])
+	if err != nil {
+		panic(err)
+	}
+	// Call the Run() method of the selected parsed command.
+	err = ctx.Run()
+
+	ctx.FatalIfErrorf(err)
+}