Task Attachments (#104)
This commit is contained in:
35
vendor/github.com/swaggo/swag/cmd/swag/main.go
generated
vendored
35
vendor/github.com/swaggo/swag/cmd/swag/main.go
generated
vendored
@ -1,15 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/swaggo/swag"
|
||||
"github.com/swaggo/swag/gen"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
const searchDirFlag = "dir"
|
||||
const generalInfoFlag = "generalInfo"
|
||||
const propertyStrategyFlag = "propertyStrategy"
|
||||
const outputFlag = "output"
|
||||
const parseVendorFlag = "parseVendor"
|
||||
const parseDependency = "parseDependency"
|
||||
const markdownFilesDirFlag = "markdownFiles"
|
||||
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Version = swag.Version
|
||||
@ -20,16 +28,18 @@ func main() {
|
||||
Aliases: []string{"i"},
|
||||
Usage: "Create docs.go",
|
||||
Action: func(c *cli.Context) error {
|
||||
searchDir := c.String("dir")
|
||||
mainAPIFile := c.String("generalInfo")
|
||||
strategy := c.String("propertyStrategy")
|
||||
outputDir := c.String("output")
|
||||
parseVendor := c.Bool("parseVendor")
|
||||
searchDir := c.String(searchDirFlag)
|
||||
mainAPIFile := c.String(generalInfoFlag)
|
||||
strategy := c.String(propertyStrategyFlag)
|
||||
outputDir := c.String(outputFlag)
|
||||
parseVendor := c.Bool(parseVendorFlag)
|
||||
parseDependency := c.Bool(parseDependency)
|
||||
markdownFilesDir := c.String(markdownFilesDirFlag)
|
||||
|
||||
switch strategy {
|
||||
case swag.CamelCase, swag.SnakeCase, swag.PascalCase:
|
||||
default:
|
||||
return errors.Errorf("not supported %s propertyStrategy", strategy)
|
||||
return fmt.Errorf("not supported %s propertyStrategy", strategy)
|
||||
}
|
||||
|
||||
return gen.New().Build(&gen.Config{
|
||||
@ -38,6 +48,8 @@ func main() {
|
||||
PropNamingStrategy: strategy,
|
||||
OutputDir: outputDir,
|
||||
ParseVendor: parseVendor,
|
||||
ParseDependency: parseDependency,
|
||||
MarkdownFilesDir: markdownFilesDir,
|
||||
})
|
||||
},
|
||||
Flags: []cli.Flag{
|
||||
@ -65,6 +77,15 @@ func main() {
|
||||
Name: "parseVendor",
|
||||
Usage: "Parse go files in 'vendor' folder, disabled by default",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "parseDependency",
|
||||
Usage: "Parse go files in outside dependency folder, disabled by default",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "markdownFiles, md",
|
||||
Value: "",
|
||||
Usage: "Parse folder containing markdown files to use as description, disabled by default",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user