2023-05-03 05:41:35 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"os/signal"
|
|
|
|
"syscall"
|
|
|
|
|
|
|
|
"github.com/alecthomas/kong"
|
2024-07-30 21:11:50 +00:00
|
|
|
"tuxpa.in/a/pprofweb/cli"
|
2023-05-03 05:41:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|