-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.go
60 lines (42 loc) · 919 Bytes
/
commands.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
55
56
57
58
59
60
package cmd
import (
"log"
"github.com/spf13/cobra"
"github.com/guidomantilla/go-feather-api-sample/cmd/serve"
)
func ExecuteAppCmd() {
appCmd := &cobra.Command{}
appCmd.AddCommand(createServeCmd(), createMigrateCmd(), createTestCmd())
if err := appCmd.Execute(); err != nil {
log.Fatalln(err.Error())
}
}
func createServeCmd() *cobra.Command {
serveCmd := &cobra.Command{
Use: "serve",
Run: serve.ExecuteCmdFn,
}
return serveCmd
}
func createMigrateCmd() *cobra.Command {
migrateUpCmd := &cobra.Command{
Use: "up",
//Run: migrate.UpCmdFn,
}
migrateDownCmd := &cobra.Command{
Use: "down",
//Run: migrate.DownCmdFn,
}
migrateCmd := &cobra.Command{
Use: "migrate",
}
migrateCmd.AddCommand(migrateUpCmd, migrateDownCmd)
return migrateCmd
}
func createTestCmd() *cobra.Command {
testCmd := &cobra.Command{
Use: "test",
//Run: test.ExecuteCmdFn,
}
return testCmd
}