about summary refs log tree commit diff
path: root/tvix/nar-bridge/cmd/nar_bridge/main.go
blob: 78ed3e272d698d2bb7b0490f609b9adcf072c0d8 (plain) (blame)
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
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)
}