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

Have keyboard widget manage its own help

Define help with keys
This means that keys and help are automatically in sync
This means that you can't define keys, but forget help
This unfortunately also means that formatting may not be quite as good
This commit is contained in:
Sean Smith
2019-05-11 11:14:02 -04:00
parent e9e62c2065
commit 7f3daaac59
47 changed files with 269 additions and 641 deletions

View File

@@ -1,39 +0,0 @@
package help
import (
"fmt"
"github.com/wtfutil/wtf/modules/git"
"github.com/wtfutil/wtf/modules/github"
"github.com/wtfutil/wtf/modules/textfile"
"github.com/wtfutil/wtf/modules/todo"
"github.com/wtfutil/wtf/modules/todoist"
"github.com/wtfutil/wtf/modules/weatherservices/weather"
)
func Display(moduleName string) {
if moduleName == "" {
fmt.Println("\n --module takes a module name as an argument, i.e: '--module=github'")
} else {
fmt.Printf("%s\n", helpFor(moduleName))
}
}
func helpFor(moduleName string) string {
switch moduleName {
case "git":
return git.HelpText
case "github":
return github.HelpText
case "textfile":
return textfile.HelpText
case "todo":
return todo.HelpText
case "todoist":
return todoist.HelpText
case "weather":
return weather.HelpText
default:
return fmt.Sprintf("\n There is no help available for '%s'", moduleName)
}
}