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

Merge pull request #530 from Seanstoppable/fixhelp

Fix help for modules
This commit is contained in:
Sean Smith 2019-08-12 12:51:12 -04:00 committed by GitHub
commit 2efa6eed7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,16 +9,23 @@ import (
)
// Display displays the output of the --help argument
func Display(moduleName string, config *config.Config) {
func Display(moduleName string, cfg *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))
fmt.Printf("%s\n", helpFor(moduleName, cfg))
}
}
func helpFor(moduleName string, config *config.Config) string {
widget := app.MakeWidget(nil, nil, moduleName, config)
func helpFor(moduleName string, cfg *config.Config) string {
cfg.Set("wtf.mods."+moduleName+".enabled", true)
widget := app.MakeWidget(nil, nil, moduleName, cfg)
// Since we are forcing enabled config, if no module
// exists, we will get the unknown one
if widget.CommonSettings().Title == "Unknown" {
return "Unable to find module " + moduleName
}
result := ""
result += utils.StripColorTags(widget.HelpText())