feat: adjust fiber route generation

This commit is contained in:
Rogee
2024-12-23 15:58:17 +08:00
parent 9d1fcdd88b
commit 319b59ce72
44 changed files with 18105 additions and 70 deletions

View File

@@ -24,7 +24,7 @@ func CommandGenRoute(root *cobra.Command) {
root.AddCommand(cmd)
}
// https://github.com/swaggo/swag?tab=readme-ov-file#api-operation
// https://git.ipao.vip/rogeecn/atomctl/pkg/swag?tab=readme-ov-file#api-operation
func commandGenRouteE(cmd *cobra.Command, args []string) error {
var err error
var path string

View File

@@ -1,8 +1,8 @@
package cmd
import (
"git.ipao.vip/rogeecn/atomctl/pkg/swag/format"
"github.com/spf13/cobra"
"github.com/swaggo/swag/format"
)
func CommandSwagFmt(root *cobra.Command) {

View File

@@ -1,10 +1,13 @@
package cmd
import (
"os"
"path/filepath"
"git.ipao.vip/rogeecn/atomctl/pkg/swag"
"git.ipao.vip/rogeecn/atomctl/pkg/swag/gen"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/swaggo/swag"
"github.com/swaggo/swag/gen"
)
func CommandSwagInit(root *cobra.Command) {
@@ -19,15 +22,23 @@ func CommandSwagInit(root *cobra.Command) {
}
func commandSwagInitE(cmd *cobra.Command, args []string) error {
pwd, err := os.Getwd()
if err != nil {
return err
}
if len(args) > 0 {
pwd = args[0]
}
leftDelim, rightDelim := "{{", "}}"
return gen.New().Build(&gen.Config{
SearchDir: "./",
SearchDir: pwd,
Excludes: "",
ParseExtension: "",
MainAPIFile: "main.go",
PropNamingStrategy: swag.CamelCase,
OutputDir: "./docs",
OutputDir: filepath.Join(pwd, "docs"),
OutputTypes: []string{"go", "json", "yaml"},
ParseVendor: false,
ParseDependency: 0,