mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
31 lines
784 B
Go
31 lines
784 B
Go
package help
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/olebedev/config"
|
|
"github.com/wtfutil/wtf/maker"
|
|
"github.com/wtfutil/wtf/utils"
|
|
)
|
|
|
|
// Display displays the output of the --help argument
|
|
func Display(moduleName string, config *config.Config) {
|
|
if moduleName == "" {
|
|
fmt.Println("\n --module takes a module name as an argument, i.e: '--module=github'")
|
|
} else {
|
|
fmt.Printf("%s\n", helpFor(moduleName, config))
|
|
}
|
|
}
|
|
|
|
func helpFor(moduleName string, config *config.Config) string {
|
|
modConfig, _ := config.Get("wtf.mods." + moduleName)
|
|
widget := maker.MakeWidget(nil, nil, moduleName, moduleName, modConfig, config)
|
|
|
|
result := ""
|
|
result += utils.StripColorTags(widget.HelpText())
|
|
result += "\n"
|
|
result += "Configuration Attributes"
|
|
result += widget.ConfigText()
|
|
return result
|
|
}
|