Skip to content

Commit

Permalink
refactor(cmd/gf): change default src value to api, path to `interna…
Browse files Browse the repository at this point in the history
…l/packed/packed_enums.go` for command `gen enums` (#3996)
  • Loading branch information
gqcn authored Dec 2, 2024
1 parent 2c916f8 commit 2d0cd7b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions cmd/gf/internal/cmd/genenums/genenums.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package genenums

import (
"context"

"golang.org/x/tools/go/packages"

"github.com/gogf/gf/cmd/gf/v2/internal/consts"
Expand All @@ -22,8 +23,8 @@ type (
CGenEnums struct{}
CGenEnumsInput struct {
g.Meta `name:"enums" config:"{CGenEnumsConfig}" brief:"{CGenEnumsBrief}" eg:"{CGenEnumsEg}"`
Src string `name:"src" short:"s" dc:"source folder path to be parsed" d:"."`
Path string `name:"path" short:"p" dc:"output go file path storing enums content" d:"internal/boot/boot_enums.go"`
Src string `name:"src" short:"s" dc:"source folder path to be parsed" d:"api"`
Path string `name:"path" short:"p" dc:"output go file path storing enums content" d:"internal/packed/packed_enums.go"`
Prefixes []string `name:"prefixes" short:"x" dc:"only exports packages that starts with specified prefixes"`
}
CGenEnumsOutput struct{}
Expand All @@ -34,8 +35,8 @@ const (
CGenEnumsBrief = `parse go files in current project and generate enums go file`
CGenEnumsEg = `
gf gen enums
gf gen enums -p internal/boot/boot_enums.go
gf gen enums -p internal/boot/boot_enums.go -s .
gf gen enums -p internal/packed/packed_enums.go
gf gen enums -p internal/packed/packed_enums.go -s .
gf gen enums -x github.com/gogf
`
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/genenums/genenums_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ package genenums
import (
"go/constant"
"go/types"
"golang.org/x/tools/go/packages"

"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/text/gstr"
"github.com/gogf/gf/v2/util/gconv"
"golang.org/x/tools/go/packages"
)

const pkgLoadMode = 0xffffff
Expand Down

0 comments on commit 2d0cd7b

Please sign in to comment.