-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
51 lines (40 loc) · 824 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
49
50
51
package main
import (
"fmt"
"os"
"github.com/quikdev/go/commands"
"github.com/quikdev/go/util"
"github.com/alecthomas/kong"
)
var (
name string
description string
version string
)
func main() {
debug := false
val := os.Getenv("DEBUG")
if val == "true" {
debug = true
}
cmd := &commands.Context{
Debug: debug,
}
if len(os.Args) < 2 {
os.Args = append(os.Args, "--help")
} else if len(os.Args) >= 2 && (util.InSlice[string]("-v", os.Args) || util.InSlice[string]("--version", os.Args)) {
fmt.Println(version)
return
}
root := &commands.Root
name = "QuikGo"
description = "Develop Go apps, modules, and web assemblies."
version = "1.2.6"
ctx := kong.Parse(
root,
kong.Name(name),
kong.Description(description+"\nv"+version),
kong.UsageOnError(),
)
ctx.Run(cmd)
}