-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
50 lines (41 loc) · 1.38 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"context"
"os"
"github.com/alecthomas/kong"
"github.com/brittonhayes/armactl/cmd/armactl/commands"
"github.com/rs/zerolog"
)
var (
Version = "vX.X.X"
)
var cli struct {
Verbose bool `help:"Enable verbose logging." default:"false" short:"v"`
Version commands.VersionCmd `cmd:"" help:"Print version of armactl." aliases:"v"`
Steam commands.SteamCmd `cmd:"" help:"Query ARMA Steam server for information."`
Keys commands.KeysCmd `cmd:"" help:"Manage bikeys for ARMA modifications."`
Mods commands.ModsCmd `cmd:"" help:"Manage ARMA modifications and presets."`
Server commands.ServerCmd `cmd:"" help:"Run ARMA3 dedicated server."`
Reforger commands.ReforgerCmd `cmd:"" help:"Manage ARMA Reforger dedicated server."`
}
func main() {
ctx := kong.Parse(&cli,
kong.Name("armactl"),
kong.Description("ARMACTL is a command line tool to simplify the management of ARMA 3 dedicated servers."),
kong.UsageOnError(),
kong.ConfigureHelp(kong.HelpOptions{
NoExpandSubcommands: true,
}),
)
logger := zerolog.New(os.Stderr).With().Timestamp().Logger().Level(zerolog.InfoLevel).Output(zerolog.ConsoleWriter{Out: os.Stderr})
if cli.Verbose {
logger = logger.Level(zerolog.DebugLevel)
}
err := ctx.Run(&commands.Context{
Ctx: context.Background(),
Log: logger,
Version: Version,
Output: os.Stdout,
})
ctx.FatalIfErrorf(err)
}