-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
48 lines (38 loc) · 933 Bytes
/
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 (
"context"
"log"
"os"
"os/signal"
"github.com/dskiff/tko/pkg/build"
"github.com/dskiff/tko/pkg/cmd"
"github.com/alecthomas/kong"
kongyaml "github.com/alecthomas/kong-yaml"
"github.com/joho/godotenv"
)
var version = "dev"
var commit = "none"
var date = "unknown"
func main() {
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
defer stop()
godotenv.Load(".env.local")
godotenv.Load(".env")
exitCleanWatcher := build.NewExitCleanupWatcher()
defer exitCleanWatcher.Close()
cliContext := cmd.CliCtx{
Context: ctx,
TkoBuildVersion: version,
TkoBuildCommit: commit,
TkoBuildDate: date,
ExitCleanWatcher: exitCleanWatcher,
}
cli := cmd.CLI{}
args := kong.Parse(&cli, kong.Configuration(kongyaml.Loader, "./.tko.yaml", "./.tko.yml"))
err := args.Run(&cliContext)
if err != nil {
log.Println(err)
exitCleanWatcher.Close()
os.Exit(1)
}
}