aboutsummaryrefslogtreecommitdiff
path: root/main.go
blob: 5d11c586eec3e9f5da776767062600cdc3c9cd29 (plain)
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
package main

import (
	"context"
	"flag"
	"log"
	"os"
	"path"

	"github.com/google/subcommands"
)

func init() {
	log.SetFlags(0)
	log.SetPrefix(progName() + ": ")
}

func progName() string {
	return path.Base(os.Args[0])
}

func main() {
	subcommands.Register(subcommands.CommandsCommand(), "")
	subcommands.Register(subcommands.FlagsCommand(), "")
	subcommands.Register(subcommands.HelpCommand(), "")

	subcommands.Register(&checkCmd{}, "")
	subcommands.Register(&generateCmd{}, "")
	subcommands.Register(&signCmd{}, "")
	subcommands.Register(&verifyCmd{}, "")

	flag.Parse()

	ctx := context.Background()
	os.Exit(int(subcommands.Execute(ctx)))
}