diff options
author | Dawid Dziurla <dawidd0811@gmail.com> | 2019-01-16 18:54:54 +0100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-01-17 10:11:17 +1100 |
commit | 0dcfa09ff25384be1b926af85ba9a9a956681db4 (patch) | |
tree | 8fb045e6c31819122f8733e406f8bac617cf3f97 /scripts | |
parent | d5401ab20016ced84638faeb32f2c4c1363e377d (diff) |
run go fmt against generator
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/generate_cheatsheet.go | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/scripts/generate_cheatsheet.go b/scripts/generate_cheatsheet.go index 466d26e3d..f427c29fa 100644 --- a/scripts/generate_cheatsheet.go +++ b/scripts/generate_cheatsheet.go @@ -9,55 +9,55 @@ package main import ( - "fmt" - "github.com/jesseduffield/lazygit/pkg/app" - "github.com/jesseduffield/lazygit/pkg/config" - "log" - "os" - "strings" + "fmt" + "github.com/jesseduffield/lazygit/pkg/app" + "github.com/jesseduffield/lazygit/pkg/config" + "log" + "os" + "strings" ) func writeString(file *os.File, str string) { - _, err := file.WriteString(str) - if err != nil { - log.Fatal(err) - } + _, err := file.WriteString(str) + if err != nil { + log.Fatal(err) + } } -func getTitle(mApp *app.App ,viewName string) string { - viewTitle := strings.Title(viewName) + "Title" - translatedTitle := mApp.Tr.SLocalize(viewTitle) - formattedTitle := fmt.Sprintf("\n## %s\n\n", translatedTitle) - return formattedTitle +func getTitle(mApp *app.App, viewName string) string { + viewTitle := strings.Title(viewName) + "Title" + translatedTitle := mApp.Tr.SLocalize(viewTitle) + formattedTitle := fmt.Sprintf("\n## %s\n\n", translatedTitle) + return formattedTitle } func main() { - mConfig, _ := config.NewAppConfig("", "", "", "", "", new(bool)) - mApp, _ := app.Setup(mConfig) - lang := mApp.Tr.GetLanguage() - file, _ := os.Create("Keybindings_" + lang + ".md") - current := "" - - writeString(file, fmt.Sprintf("# Lazygit %s\n", mApp.Tr.SLocalize("menu"))) - writeString(file, getTitle(mApp, "global")) - - writeString(file, "<pre>\n") - - for _, binding := range mApp.Gui.GetKeybindings() { - if binding.Description == "" { - continue - } - - if binding.ViewName != current { - current = binding.ViewName - writeString(file, "</pre>\n") - writeString(file, getTitle(mApp, current)) - writeString(file, "<pre>\n") - } - - info := fmt.Sprintf(" <kbd>%s</kbd>: %s\n", binding.GetKey(), binding.Description) - writeString(file, info) - } - - writeString(file, "</pre>\n") + mConfig, _ := config.NewAppConfig("", "", "", "", "", new(bool)) + mApp, _ := app.Setup(mConfig) + lang := mApp.Tr.GetLanguage() + file, _ := os.Create("Keybindings_" + lang + ".md") + current := "" + + writeString(file, fmt.Sprintf("# Lazygit %s\n", mApp.Tr.SLocalize("menu"))) + writeString(file, getTitle(mApp, "global")) + + writeString(file, "<pre>\n") + + for _, binding := range mApp.Gui.GetKeybindings() { + if binding.Description == "" { + continue + } + + if binding.ViewName != current { + current = binding.ViewName + writeString(file, "</pre>\n") + writeString(file, getTitle(mApp, current)) + writeString(file, "<pre>\n") + } + + info := fmt.Sprintf(" <kbd>%s</kbd>: %s\n", binding.GetKey(), binding.Description) + writeString(file, info) + } + + writeString(file, "</pre>\n") } |