summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-01-04 09:20:38 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-01-04 09:33:35 +1100
commit8e66d2761ee6580981d6d465e9d970c6a80d3e65 (patch)
tree1ad294f0b0c4cd1f2609a3ab3b23d536f4730e9f /scripts
parent95b2e9540a55973a6ab32dd4522648634ab15b0a (diff)
make it clear that keybinding cheat sheets are auto-generated
Diffstat (limited to 'scripts')
-rw-r--r--scripts/generate_cheatsheet.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/scripts/generate_cheatsheet.go b/scripts/generate_cheatsheet.go
index e2200b694..fc188b6f9 100644
--- a/scripts/generate_cheatsheet.go
+++ b/scripts/generate_cheatsheet.go
@@ -18,6 +18,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/app"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/gui"
+ "github.com/jesseduffield/lazygit/pkg/i18n"
)
type bindingSection struct {
@@ -26,10 +27,10 @@ type bindingSection struct {
}
func main() {
- langs := []string{"pl", "nl", "en"}
- mConfig, _ := config.NewAppConfig("", "", "", "", "", true)
+ translationSetsByLang := i18n.GetTranslationSets()
+ mConfig := config.NewDummyAppConfig()
- for _, lang := range langs {
+ for lang := range translationSetsByLang {
os.Setenv("LC_ALL", lang)
mApp, _ := app.NewApp(mConfig, "")
file, err := os.Create(getProjectRoot() + "/docs/keybindings/Keybindings_" + lang + ".md")
@@ -38,7 +39,9 @@ func main() {
}
bindingSections := getBindingSections(mApp)
- content := formatSections(mApp, bindingSections)
+ content := formatSections(mApp.Tr, bindingSections)
+ content = fmt.Sprintf("# This file is auto-generated. To update, make the changes in the "+
+ "pkg/i18n directory and then run `go run scripts/generate_cheatsheet.go` from the project root.\n\n%s", content)
writeString(file, content)
}
}
@@ -231,8 +234,8 @@ func addBinding(title string, bindingSections []*bindingSection, binding *gui.Bi
return append(bindingSections, section)
}
-func formatSections(mApp *app.App, bindingSections []*bindingSection) string {
- content := fmt.Sprintf("# Lazygit %s\n", mApp.Tr.Keybindings)
+func formatSections(tr *i18n.TranslationSet, bindingSections []*bindingSection) string {
+ content := fmt.Sprintf("# Lazygit %s\n", tr.Keybindings)
for _, section := range bindingSections {
content += formatTitle(section.title)