1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Get --module=[modname] working again (broke when position config validation was added)

This commit is contained in:
Chris Cummer
2019-07-06 01:55:54 -07:00
parent 2b2cdf912b
commit 2da3344612
5 changed files with 19 additions and 9 deletions

View File

@@ -28,20 +28,24 @@ func StripColorTags(input string) string {
func helpFromValue(field reflect.StructField) string {
result := ""
var help string = field.Tag.Get("help")
optional, err := strconv.ParseBool(field.Tag.Get("optional"))
if err != nil {
optional = false
}
var values string = field.Tag.Get("values")
help := field.Tag.Get("help")
if optional {
help = "Optional " + help
}
values := field.Tag.Get("values")
if help != "" {
result += "\n\n" + lowercaseTitle(field.Name)
result += "\n" + help
result += "\n\n " + lowercaseTitle(field.Name)
result += "\n " + help
if values != "" {
result += "\nValues: " + values
result += "\n Values: " + values
}
}
@@ -49,7 +53,6 @@ func helpFromValue(field reflect.StructField) string {
}
func HelpFromInterface(item interface{}) string {
result := ""
t := reflect.TypeOf(item)