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

Add more 'man page' like functionality

This commit is contained in:
Sean Smith
2019-05-24 00:06:10 -04:00
parent 9a877b5e04
commit d8f337884f
8 changed files with 109 additions and 14 deletions

View File

@@ -3,6 +3,7 @@ package git
import (
"github.com/olebedev/config"
"github.com/wtfutil/wtf/cfg"
"github.com/wtfutil/wtf/utils"
)
const defaultTitle = "Git"
@@ -10,10 +11,10 @@ const defaultTitle = "Git"
type Settings struct {
common *cfg.Common
commitCount int
commitFormat string
dateFormat string
repositories []interface{}
commitCount int `help:"The number of past commits to display." values:"A positive integer, 0..n."`
commitFormat string `help:"The string format for the commit message." optional:"true"`
dateFormat string `help:"The string format for the date/time in the commit message." optional:"true"`
repositories []interface{} `help:"Defines which git repositories to watch." values:"A list of zero or more local file paths pointing to valid git repositories."`
}
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
@@ -29,3 +30,11 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
return &settings
}
func (widget *Widget) ConfigText() string {
return utils.HelpFromInterface(Settings{})
}
func (widget *Widget) HelpText() string {
return widget.KeyboardWidget.HelpText()
}

View File

@@ -85,10 +85,6 @@ func (widget *Widget) Refresh() {
widget.display()
}
func (widget *Widget) HelpText() string {
return widget.KeyboardWidget.HelpText()
}
/* -------------------- Unexported Functions -------------------- */
func (widget *Widget) addCheckoutButton(form *tview.Form, fctn func()) {