mirror of
				https://github.com/jesseduffield/lazygit.git
				synced 2025-10-30 23:57:43 +02:00 
			
		
		
		
	fix 'main' redefinition in scripts/ dir
This commit is contained in:
		| @@ -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) | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @@ -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 | ||||
		Reference in New Issue
	
	Block a user