mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-25 12:24:47 +02:00
run go fmt against generator
This commit is contained in:
parent
d5401ab200
commit
0dcfa09ff2
@ -9,55 +9,55 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/jesseduffield/lazygit/pkg/app"
|
"github.com/jesseduffield/lazygit/pkg/app"
|
||||||
"github.com/jesseduffield/lazygit/pkg/config"
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func writeString(file *os.File, str string) {
|
func writeString(file *os.File, str string) {
|
||||||
_, err := file.WriteString(str)
|
_, err := file.WriteString(str)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getTitle(mApp *app.App ,viewName string) string {
|
func getTitle(mApp *app.App, viewName string) string {
|
||||||
viewTitle := strings.Title(viewName) + "Title"
|
viewTitle := strings.Title(viewName) + "Title"
|
||||||
translatedTitle := mApp.Tr.SLocalize(viewTitle)
|
translatedTitle := mApp.Tr.SLocalize(viewTitle)
|
||||||
formattedTitle := fmt.Sprintf("\n## %s\n\n", translatedTitle)
|
formattedTitle := fmt.Sprintf("\n## %s\n\n", translatedTitle)
|
||||||
return formattedTitle
|
return formattedTitle
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
mConfig, _ := config.NewAppConfig("", "", "", "", "", new(bool))
|
mConfig, _ := config.NewAppConfig("", "", "", "", "", new(bool))
|
||||||
mApp, _ := app.Setup(mConfig)
|
mApp, _ := app.Setup(mConfig)
|
||||||
lang := mApp.Tr.GetLanguage()
|
lang := mApp.Tr.GetLanguage()
|
||||||
file, _ := os.Create("Keybindings_" + lang + ".md")
|
file, _ := os.Create("Keybindings_" + lang + ".md")
|
||||||
current := ""
|
current := ""
|
||||||
|
|
||||||
writeString(file, fmt.Sprintf("# Lazygit %s\n", mApp.Tr.SLocalize("menu")))
|
writeString(file, fmt.Sprintf("# Lazygit %s\n", mApp.Tr.SLocalize("menu")))
|
||||||
writeString(file, getTitle(mApp, "global"))
|
writeString(file, getTitle(mApp, "global"))
|
||||||
|
|
||||||
writeString(file, "<pre>\n")
|
writeString(file, "<pre>\n")
|
||||||
|
|
||||||
for _, binding := range mApp.Gui.GetKeybindings() {
|
for _, binding := range mApp.Gui.GetKeybindings() {
|
||||||
if binding.Description == "" {
|
if binding.Description == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if binding.ViewName != current {
|
if binding.ViewName != current {
|
||||||
current = binding.ViewName
|
current = binding.ViewName
|
||||||
writeString(file, "</pre>\n")
|
writeString(file, "</pre>\n")
|
||||||
writeString(file, getTitle(mApp, current))
|
writeString(file, getTitle(mApp, current))
|
||||||
writeString(file, "<pre>\n")
|
writeString(file, "<pre>\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
info := fmt.Sprintf(" <kbd>%s</kbd>: %s\n", binding.GetKey(), binding.Description)
|
info := fmt.Sprintf(" <kbd>%s</kbd>: %s\n", binding.GetKey(), binding.Description)
|
||||||
writeString(file, info)
|
writeString(file, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
writeString(file, "</pre>\n")
|
writeString(file, "</pre>\n")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user