diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-03-22 20:13:48 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-03-22 20:20:06 +1100 |
commit | e68dbeb7ebdd42a48e0a35ad436ef86be50569d7 (patch) | |
tree | 8e092cf0f8f18332928b55040c14ab8191fbba43 /scripts | |
parent | 32ddf0c2960e1076c526b542332f8233d916e2dd (diff) |
organise keybindings better
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/generate_cheatsheet.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/generate_cheatsheet.go b/scripts/generate_cheatsheet.go index 529f37da8..7741c783f 100644 --- a/scripts/generate_cheatsheet.go +++ b/scripts/generate_cheatsheet.go @@ -31,7 +31,10 @@ func main() { for _, lang := range langs { os.Setenv("LC_ALL", lang) mApp, _ := app.NewApp(mConfig) - file, _ := os.Create("Keybindings_" + lang + ".md") + file, err := os.Create(getProjectRoot() + "/docs/keybindings/Keybindings_" + lang + ".md") + if err != nil { + panic(err) + } bindingSections := getBindingSections(mApp) content := formatSections(mApp, bindingSections) @@ -126,3 +129,11 @@ func formatSections(mApp *app.App, bindingSections []*bindingSection) string { return content } + +func getProjectRoot() string { + dir, err := os.Getwd() + if err != nil { + panic(err) + } + return strings.Split(dir, "lazygit")[0] + "lazygit" +} |