-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfetc.go
41 lines (38 loc) · 852 Bytes
/
fetc.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
package main
import (
"fmt"
"log"
"os"
"os/exec"
"github.com/fefit/fetc/commands"
"github.com/urfave/cli/v2"
)
func main() {
var (
fetVersion []byte
err error
)
fetVersion, err = exec.Command("bash", "-c", "go list -m -u github.com/fefit/fet|awk '{print $2}'").Output()
usage := "'fetc' is the command line tool of 'fet' template engine"
if err == nil {
usage += ", cur version of 'fet' is " + string(fetVersion)
}
// create the command line
app := cli.NewApp()
app.Name = "fetc"
app.Usage = usage
app.Commands = []*cli.Command{
commands.Init(),
commands.Watch(),
commands.Compile(),
}
app.Action = func(c *cli.Context) error {
fmt.Println("welcome to use 'fet' template engine, use 'fetc -h' for helps.")
return nil
}
app.Version = "0.1.11"
err = app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}