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

@@ -6,13 +6,11 @@ import (
"path/filepath"
goFlags "github.com/jessevdk/go-flags"
"github.com/wtfutil/wtf/help"
"github.com/wtfutil/wtf/utils"
)
type Flags struct {
Config string `short:"c" long:"config" optional:"yes" description:"Path to config file"`
Module string `short:"m" long:"module" optional:"yes" description:"Display info about a specific module, i.e.: 'wtf -m=todo'"`
Profile bool `short:"p" long:"profile" optional:"yes" description:"Profile application memory usage"`
Version bool `short:"v" long:"version" description:"Show version info"`
}
@@ -29,11 +27,6 @@ func (flags *Flags) ConfigFilePath() string {
}
func (flags *Flags) Display(version string) {
if flags.HasModule() {
help.Display(flags.Module)
os.Exit(0)
}
if flags.HasVersion() {
fmt.Println(version)
os.Exit(0)
@@ -44,10 +37,6 @@ func (flags *Flags) HasConfig() bool {
return len(flags.Config) > 0
}
func (flags *Flags) HasModule() bool {
return len(flags.Module) > 0
}
func (flags *Flags) HasVersion() bool {
return flags.Version == true
}