pprofweb/main.go
2023-05-03 00:41:35 -05:00

28 lines
475 B
Go

package main
import (
"context"
"fmt"
"os"
"os/signal"
"syscall"
"git.tuxpa.in/a/pprofweb/cli"
"github.com/alecthomas/kong"
)
func main() {
ctx := NewCLI()
sctx, cn := signal.NotifyContext(context.Background(), os.Kill, syscall.SIGTERM, syscall.SIGILL)
defer cn()
if err := ctx.Run(cli.Context{Context: sctx}); err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
}
}
func NewCLI() *kong.Context {
ctx := kong.Parse(&cli.CLI)
return ctx
}