23 lines
566 B
Go
23 lines
566 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"go.maximumdirect.net/commandkit"
|
|
|
|
"gitea.maximumdirect.net/eric/narratio/internal/app"
|
|
)
|
|
|
|
func main() {
|
|
os.Exit(runProcess(os.Args[1:], commandkit.Streams{Out: os.Stdout, Err: os.Stderr}, app.Execute))
|
|
}
|
|
|
|
func runProcess(args []string, streams commandkit.Streams, execute func(context.Context, []string, commandkit.Streams) commandkit.Outcome) int {
|
|
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
|
defer stop()
|
|
return execute(ctx, args, streams).Status
|
|
}
|