1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-26 09:00:57 +02:00

Merge pull request #333 from jirfag/master

fix 'main' redefinition in scripts/ dir
This commit is contained in:
Jesse Duffield 2018-11-26 19:54:08 +11:00 committed by GitHub
commit 55712f509c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 55 deletions

View File

@ -1,54 +0,0 @@
// run:
// LANG=en go run generate_cheatsheet.go
// to generate Keybindings_en.md file in current directory
// change LANG to generate cheatsheet in different language (if supported)
package main
import (
"fmt"
"os"
"strings"
"github.com/jesseduffield/lazygit/pkg/app"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/utils"
)
func main() {
appConfig, _ := config.NewAppConfig("", "", "", "", "", new(bool))
a, _ := app.NewApp(appConfig)
lang := a.Tr.GetLanguage()
name := "Keybindings_" + lang + ".md"
bindings := a.Gui.GetKeybindings()
padWidth := a.Gui.GetMaxKeyLength(bindings)
file, _ := os.Create(name)
current := "v"
content := ""
title := ""
file.WriteString("# Lazygit " + a.Tr.SLocalize("menu"))
for _, binding := range bindings {
if key := a.Gui.GetKey(binding); key != "" && (binding.Description != "" || key == "x") {
if binding.ViewName != current {
current = binding.ViewName
if current == "" {
title = a.Tr.SLocalize("GlobalTitle")
} else {
title = a.Tr.SLocalize(strings.Title(current) + "Title")
}
content = fmt.Sprintf("</pre>\n\n## %s\n<pre>\n", title)
file.WriteString(content)
}
// workaround to include menu keybinding in cheatsheet
// could not add this Description field directly to keybindings.go,
// because then menu key would be displayed in menu itself and that is undesirable
if key == "x" {
binding.Description = a.Tr.SLocalize("menu")
}
content = fmt.Sprintf("\t<kbd>%s</kbd>%s %s\n", key, strings.TrimPrefix(utils.WithPadding(key, padWidth), key), binding.Description)
file.WriteString(content)
}
}
}

View File

@ -1,5 +1,5 @@
// call from project root with // call from project root with
// go run bin/push_new_patch.go // go run scripts/push_new_patch/main.go
// goreleaser expects a $GITHUB_TOKEN env variable to be defined // goreleaser expects a $GITHUB_TOKEN env variable to be defined
// in order to push the release got github // in order to push the release got github