-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
54 lines (51 loc) · 1.13 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
49
50
51
52
53
54
package main
import (
"fmt"
"log"
"os"
"path/filepath"
"time"
"github.com/Allan-Nava/Go-DDD-Scaffold/scaffold"
"github.com/urfave/cli/v2"
)
func main() {
//
app := &cli.App{
Name: "scaffold",
Version: "v1.0.1",
Compiled: time.Now(),
Usage: "Generate scaffold go-ddd project layout",
Commands: []*cli.Command{
{
Name: "init",
Aliases: []string{"i"},
Usage: " Generate scaffold project layout",
Action: func(c *cli.Context) error {
currDir, err := filepath.Abs(filepath.Dir(os.Args[0]))
if err != nil {
log.Println("err filepath.Abs ", err)
return err
}
err = scaffold.New(false).Generate(currDir)
fmt.Printf("error:%+v currDir %s\n ", err, currDir)
if err == nil {
fmt.Println("Success Created. Please excute `make up` to start service.")
}
return err
},
}, {
Name: "help",
Aliases: []string{"help"},
Usage: "Help scaffold project layout",
Action: func(c *cli.Context) error {
log.Println("help cli.Context", c)
return nil
},
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}