buildr/main.go
Peter e60726ef9e
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
feat: implement new and man for plugin modules
- use extracted shared libraries
2023-08-23 22:06:26 +02:00

36 lines
638 B
Go

package main
import (
"context"
"errors"
"log/slog"
"os"
"os/signal"
"code.icb4dc0.de/buildr/buildr/internal/cmd"
"code.icb4dc0.de/buildr/buildr/internal/errs"
)
func main() {
slogOptions := slog.HandlerOptions{
AddSource: true,
Level: slog.LevelInfo,
}
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, &slogOptions)))
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill)
app := cmd.NewApp()
if err := app.Run(ctx); err != nil {
if !errors.Is(err, errs.ErrAlreadyLogged) {
slog.Error("Error occurred", slog.Any("error", err))
}
cancel()
os.Exit(1)
}
cancel()
}