-
Notifications
You must be signed in to change notification settings - Fork 13
/
main.go
60 lines (56 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
55
56
57
58
59
60
package main
import (
"log"
"os"
"github.com/teambition/swaggo/parser"
"github.com/urfave/cli"
)
const (
version = "v0.2.8"
)
func main() {
app := cli.NewApp()
app.Version = version
app.Name = "swaggo"
app.HelpName = "swaggo"
app.Usage = "a utility for convert go annotations to swagger-doc"
app.Flags = []cli.Flag{
cli.BoolFlag{
Name: "dev, d",
Usage: "develop mode",
},
cli.StringFlag{
Name: "swagger, s",
Value: "./swagger.go",
Usage: "where is the swagger.go file",
},
cli.StringFlag{
Name: "project, p",
Value: "./",
Usage: "where is the project",
},
cli.StringFlag{
Name: "output, o",
Value: "./",
Usage: "the output of the swagger file that was generated",
},
cli.StringFlag{
Name: "type, t",
Value: "json",
Usage: "the type of swagger file (json or yaml)",
},
}
app.Action = func(c *cli.Context) error {
if err := parser.Parse(c.String("project"),
c.String("swagger"),
c.String("output"),
c.String("type"),
c.Bool("dev")); err != nil {
return err
}
return nil
}
if err := app.Run(os.Args); err != nil {
log.Printf("[Error] %v", err)
}
}