From 9196a966c5badc9a746068327b49bf90e4f0ac92 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 2 Jan 2024 21:46:32 +0100 Subject: [PATCH] fix: fix doc types and add missing dict (#48) --- docs/docs.go | 12 +++++++++--- docs/docs_test.go | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 6c4f41f..c1a1385 100644 --- a/docs/docs.go +++ b/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 } diff --git a/docs/docs_test.go b/docs/docs_test.go index 0bbb505..a874556 100644 --- a/docs/docs_test.go +++ b/docs/docs_test.go @@ -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, }, {