feat: add swag command
This commit is contained in:
25
cmd/swag_fmt.go
Normal file
25
cmd/swag_fmt.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/swaggo/swag/format"
|
||||
)
|
||||
|
||||
func CommandSwagFmt(root *cobra.Command) {
|
||||
cmd := &cobra.Command{
|
||||
Use: "fmt",
|
||||
Aliases: []string{"f"},
|
||||
Short: "swag format",
|
||||
RunE: commandSwagFmtE,
|
||||
}
|
||||
|
||||
root.AddCommand(cmd)
|
||||
}
|
||||
|
||||
func commandSwagFmtE(cmd *cobra.Command, args []string) error {
|
||||
return format.New().Build(&format.Config{
|
||||
SearchDir: "./app/http",
|
||||
Excludes: "",
|
||||
MainFile: "main.go",
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user