mirror of
https://github.com/thegeeklab/wp-plugin-go.git
synced 2024-11-21 14:10:39 +00:00
fix: fix doc types and add missing dict (#48)
This commit is contained in:
parent
5dce9de670
commit
9196a966c5
12
docs/docs.go
12
docs/docs.go
@ -115,18 +115,24 @@ func parseFlags(flags []cli.Flag) []*PluginArg {
|
||||
|
||||
func parseType(raw string) string {
|
||||
reSlice := regexp.MustCompile(`^\*cli\.(.+?)SliceFlag$`)
|
||||
|
||||
if reSlice.MatchString(raw) {
|
||||
return "list"
|
||||
}
|
||||
|
||||
reMap := regexp.MustCompile(`^\*cli\.(.+?)MapFlag$`)
|
||||
if reMap.MatchString(raw) {
|
||||
return "dict"
|
||||
}
|
||||
|
||||
re := regexp.MustCompile(`^\*cli\.(.+?)Flag$`)
|
||||
match := re.FindStringSubmatch(raw)
|
||||
|
||||
if len(match) > 1 {
|
||||
switch ctype := strings.ToLower(match[1]); ctype {
|
||||
case "int", "int64", "uint", "uint64", "float64":
|
||||
return "number"
|
||||
case "int", "int64", "uint", "uint64":
|
||||
return "integer"
|
||||
case "float64":
|
||||
return "float"
|
||||
default:
|
||||
return ctype
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ func TestToData(t *testing.T) {
|
||||
Name: "dummy_flag_int",
|
||||
Description: "dummy int flag desc",
|
||||
Default: "10",
|
||||
Type: "number",
|
||||
Type: "integer",
|
||||
Required: true,
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user