summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDenis Isaev <denis@golangci.com>2018-11-24 12:15:54 +0300
committerDenis Isaev <denis@golangci.com>2018-11-24 12:23:46 +0300
commit4e8e4612bd20ed12fa4b64f825f050e45ce5f9bd (patch)
tree5f5a2eb97e066c5f8f8bcb8b90acbeaf67ec4cea /scripts
parentb9ecb82cb7ea5be027ebfcfa33ad45287e08c5f7 (diff)
fix 'main' redefinition in scripts/ dir
Diffstat (limited to 'scripts')
-rw-r--r--scripts/generate_cheatsheet.go54
-rwxr-xr-xscripts/push_new_patch/main.go (renamed from scripts/push_new_patch.go)2
2 files changed, 1 insertions, 55 deletions
diff --git a/scripts/generate_cheatsheet.go b/scripts/generate_cheatsheet.go
deleted file mode 100644
index cfa6d92ad..000000000
--- a/scripts/generate_cheatsheet.go
+++ /dev/null
@@ -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)
- }
- }
-}
diff --git a/scripts/push_new_patch.go b/scripts/push_new_patch/main.go
index e11865fff..b1660d3c1 100755
--- a/scripts/push_new_patch.go
+++ b/scripts/push_new_patch/main.go
@@ -1,5 +1,5 @@
// 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
// in order to push the release got github