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

Adds the Github module to the documentation

This commit is contained in:
Chris Cummer
2018-05-09 22:59:20 -07:00
parent c74db0177a
commit 33278dcc47
29 changed files with 377 additions and 31 deletions

View File

@@ -11,6 +11,17 @@ import (
// Config is a pointer to the global config object
var Config *config.Config
const helpText = `
Keyboard commands for Git:
/: Show/hide this help window
h: Previous git repository
l: Next git repository
arrow left: Previous git repository
arrow right: Next git repository
`
type Widget struct {
wtf.TextWidget
@@ -63,14 +74,14 @@ func (widget *Widget) Prev() {
/* -------------------- Unexported Functions -------------------- */
func (widget *Widget) buildRepoCollection(repoData map[string]interface{}) []*GithubRepo {
githubColl := []*GithubRepo{}
githubRepos := []*GithubRepo{}
for name, owner := range repoData {
repo := NewGithubRepo(name, owner.(string))
githubColl = append(githubColl, repo)
githubColl = append(githubRepos, repo)
}
return githubColl
return githubRepos
}
func (widget *Widget) currentData() *GithubRepo {
@@ -86,6 +97,15 @@ func (widget *Widget) currentData() *GithubRepo {
}
func (widget *Widget) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
switch string(event.Rune()) {
case "h":
widget.Prev()
return nil
case "l":
widget.Next()
return nil
}
switch event.Key() {
case tcell.KeyLeft:
widget.Prev()