-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.go
48 lines (37 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
// Copyright 2018-20 PJ Engineering and Business Solutions Pty. Ltd. All rights reserved.
package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/rocketlaunchr/igo/cmds"
"github.com/rocketlaunchr/igo/config"
)
// tempGeneratedFiles maps the actual source file to the temporary generated file
var tempGeneratedFiles map[string]string
func init() {
tempGeneratedFiles = make(map[string]string)
}
func main() {
var rootCmd = &cobra.Command{
Use: "igo",
}
var versionCmd = &cobra.Command{
Use: "version",
Short: "Version prints the igo version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("igo version: " + config.VERSION)
},
}
var buildCmd = &cobra.Command{
Use: "build",
Short: "Transpile igo files to go files",
Run: cmds.BuildCmd,
}
rootCmd.AddCommand(buildCmd, versionCmd)
err := rootCmd.Execute()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}