mailhole/main.go
2023-05-28 09:21:56 +00:00

35 lines
890 B
Go

package main
import (
"context"
"flag"
"os"
"github.com/google/subcommands"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/rs/zerolog/pkgerrors"
"git.tcp.direct/hgc/mailhole/cmd/firstrun"
"git.tcp.direct/hgc/mailhole/cmd/serve"
"git.tcp.direct/hgc/mailhole/cmd/systemd"
)
func main() {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
log.Logger = log.With().Caller().Logger()
zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack
subcommands.Register(subcommands.HelpCommand(), "")
subcommands.Register(subcommands.FlagsCommand(), "")
subcommands.Register(subcommands.CommandsCommand(), "")
subcommands.Register(&firstrun.FirstrunCommand{}, "")
subcommands.Register(&systemd.SystemdCommand{}, "")
subcommands.Register(&serve.ServeCommand{}, "")
flag.Parse()
ctx := context.Background()
os.Exit(int(subcommands.Execute(ctx)))
}