mautrix-discord/main.go

44 lines
1 KiB
Go
Raw Normal View History

2021-11-18 07:30:50 +00:00
package main
import (
"fmt"
"os"
"github.com/alecthomas/kong"
2022-05-20 13:37:41 +00:00
"go.mau.fi/mautrix-discord/config"
"go.mau.fi/mautrix-discord/consts"
"go.mau.fi/mautrix-discord/globals"
"go.mau.fi/mautrix-discord/registration"
"go.mau.fi/mautrix-discord/run"
"go.mau.fi/mautrix-discord/version"
2021-11-18 07:30:50 +00:00
)
var cli struct {
globals.Globals
2021-11-20 09:27:46 +00:00
GenerateConfig config.Cmd `kong:"cmd,help='Generate the default configuration and exit.'"`
GenerateRegistration registration.Cmd `kong:"cmd,help='Generate the registration file for synapse and exit.'"`
Run run.Cmd `kong:"cmd,help='Run the bridge.',default='1'"`
2021-11-20 09:27:46 +00:00
Version version.Cmd `kong:"cmd,help='Display the version and exit.'"`
2021-11-18 07:30:50 +00:00
}
func main() {
ctx := kong.Parse(
&cli,
kong.Name(consts.Name),
kong.Description(consts.Description),
kong.UsageOnError(),
kong.ConfigureHelp(kong.HelpOptions{
Compact: true,
Summary: true,
}),
)
err := ctx.Run(&cli.Globals)
if err != nil {
fmt.Fprintf(os.Stderr, "error: %s\n", err)
os.Exit(1)
}
}