feat: add swag command

This commit is contained in:
Rogee
2024-12-21 00:00:14 +08:00
parent 401ed9a5bd
commit c5ecd6a36c
6 changed files with 151 additions and 5 deletions

25
cmd/swag_fmt.go Normal file
View 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",
})
}