-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
48 lines (39 loc) · 1.07 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
package main
import (
_ "embed"
"github.com/alecthomas/kong"
"github.com/merlindorin/hoomy/cmd/hoomy/commands"
"github.com/merlindorin/hoomy/cmd/hoomy/globals"
"github.com/merlindorin/hoomy/internal/cmd"
)
var (
license string
version = "dev"
commit = "dirty"
date = "latest"
buildSource = "source"
)
type CLI struct {
*cmd.Commons
*globals.Globals
Venitian commands.VenitianCmd `cmd:"venitians"`
Devices commands.DeviceCmd `cmd:"devices" help:"list devices availables in the current system"`
Listen commands.ListenCmd `cmd:"listen" help:"listen events in the current system"`
Discover commands.DiscoverCmd `cmd:"discover" help:"list for systems available"`
}
func main() {
cli := CLI{
Commons: &cmd.Commons{
Version: cmd.NewVersion(version, commit, buildSource, date),
Licence: cmd.NewLicence(license),
},
Globals: &globals.Globals{},
}
ctx := kong.Parse(
&cli,
kong.Name("hoomy"),
kong.Description("Simple cli for managing my home automation"),
kong.UsageOnError(),
)
ctx.FatalIfErrorf(ctx.Run(cli.Globals, cli.Commons))
}