| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "os" |
| 6 | |
| 7 | "github.com/spf13/cobra" |
| 8 | ) |
| 9 | |
| 10 | // Set via ldflags at build time: |
| 11 | // |
| 12 | // go build -ldflags "-X main.version=v1.0.0 -X main.commit=$(git rev-parse --short HEAD) -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" |
| 13 | var ( |
| 14 | version = "dev" |
| 15 | commit = "unknown" |
| 16 | date = "unknown" |
| 17 | ) |
| 18 | |
| 19 | func main() { |
| 20 | root := &cobra.Command{ |
| 21 | Use: "curator", |
| 22 | Short: "Vanity Go module server with GOPROXY, sumdb, admin UI, and documentation", |
| 23 | Version: fmt.Sprintf("%s (commit: %s, built: %s)", version, commit, date), |
| 24 | } |
| 25 | |
| 26 | root.AddCommand(serveCmd()) |
| 27 | root.AddCommand(genkeyCmd()) |
| 28 | root.AddCommand(importCmd()) |
| 29 | root.AddCommand(initConfigCmd()) |
| 30 | |
| 31 | if err := root.Execute(); err != nil { |
| 32 | fmt.Fprintln(os.Stderr, err) |
| 33 | os.Exit(1) |
| 34 | } |
| 35 | } |
| 36 | |