Parse roles in the help strings

This commit is contained in:
Kovid Goyal
2022-08-14 23:26:56 +05:30
parent c97556de65
commit abaafc2d68
4 changed files with 134 additions and 23 deletions

View File

@@ -18,9 +18,10 @@ type VersionType struct {
var VersionString string
var Version VersionType
var VCSRevision string
var WebsiteBaseUrl string
func init() {
var verpat = regexp.MustCompile(`Version\((\d+),\s*(\d+),\s*(\d+)\)`)
verpat := regexp.MustCompile(`Version\((\d+),\s*(\d+),\s*(\d+)\)`)
matches := verpat.FindStringSubmatch(raw)
major, err := strconv.Atoi(matches[1])
minor, err := strconv.Atoi(matches[2])
@@ -40,5 +41,11 @@ func init() {
}
}
}
website_pat := regexp.MustCompile(`website_base_url\s+=\s+['"](.+?)['"]`)
matches = website_pat.FindStringSubmatch(raw)
WebsiteBaseUrl = matches[1]
if matches[1] == "" {
panic(fmt.Errorf("Failed to find the website base url"))
}
}