mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-03-19 21:28:28 +02:00
Merge branch 'master' into feature/ignore-hidden-files
This commit is contained in:
commit
a8fdf1a646
@ -2,14 +2,23 @@ version: 2
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/golang:1.10
|
- image: circleci/golang:1.11
|
||||||
|
|
||||||
working_directory: /go/src/github.com/jesseduffield/lazygit
|
working_directory: /go/src/github.com/jesseduffield/lazygit
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- run:
|
||||||
keys:
|
name: Ensure go.mod file is up to date
|
||||||
- pkg-cache-{{ checksum "Gopkg.lock" }}-v1
|
command: |
|
||||||
|
export GO111MODULE=on
|
||||||
|
mv go.mod /tmp/
|
||||||
|
go mod init
|
||||||
|
export GO111MODULE=auto
|
||||||
|
|
||||||
|
if [ $(diff /tmp/go.mod go.mod|wc -l) -gt 0 ]; then
|
||||||
|
diff /tmp/go.mod go.mod
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
- run:
|
- run:
|
||||||
name: Run gofmt -s
|
name: Run gofmt -s
|
||||||
command: |
|
command: |
|
||||||
@ -17,6 +26,9 @@ jobs:
|
|||||||
find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \;
|
find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \;
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- pkg-cache-{{ checksum "Gopkg.lock" }}-v2
|
||||||
- run:
|
- run:
|
||||||
name: Run tests
|
name: Run tests
|
||||||
command: |
|
command: |
|
||||||
@ -31,7 +43,7 @@ jobs:
|
|||||||
command: |
|
command: |
|
||||||
bash <(curl -s https://codecov.io/bash)
|
bash <(curl -s https://codecov.io/bash)
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: pkg-cache-{{ checksum "Gopkg.lock" }}-v1
|
key: pkg-cache-{{ checksum "Gopkg.lock" }}-v2
|
||||||
paths:
|
paths:
|
||||||
- ~/.cache/go-build
|
- ~/.cache/go-build
|
||||||
|
|
||||||
|
62
go.mod
Normal file
62
go.mod
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
module github.com/jesseduffield/lazygit
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/aws/aws-sdk-go v1.15.21
|
||||||
|
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d
|
||||||
|
github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21
|
||||||
|
github.com/davecgh/go-spew v1.1.0
|
||||||
|
github.com/emirpasic/gods v1.9.0
|
||||||
|
github.com/fatih/color v1.7.0
|
||||||
|
github.com/fsnotify/fsnotify v1.4.7
|
||||||
|
github.com/go-ini/ini v1.38.2
|
||||||
|
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
|
||||||
|
github.com/hashicorp/go-cleanhttp v0.0.0-20171218145408-d5fe4b57a186
|
||||||
|
github.com/hashicorp/go-getter v0.0.0-20180809191950-4bda8fa99001
|
||||||
|
github.com/hashicorp/go-safetemp v0.0.0-20180326211150-b1a1dbde6fdc
|
||||||
|
github.com/hashicorp/go-version v1.0.0
|
||||||
|
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce
|
||||||
|
github.com/heroku/rollrus v0.0.0-20180515183152-fc0cef2ff331
|
||||||
|
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99
|
||||||
|
github.com/jesseduffield/go-getter v0.0.0-20180822080847-906e15686e63
|
||||||
|
github.com/jesseduffield/gocui v0.0.0-20180905104005-2cb6e95bbbf8
|
||||||
|
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8
|
||||||
|
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1
|
||||||
|
github.com/kevinburke/ssh_config v0.0.0-20180317175531-9fc7bb800b55
|
||||||
|
github.com/magiconair/properties v1.8.0
|
||||||
|
github.com/mattn/go-colorable v0.0.9
|
||||||
|
github.com/mattn/go-isatty v0.0.3
|
||||||
|
github.com/mattn/go-runewidth v0.0.2
|
||||||
|
github.com/mgutz/str v1.2.0
|
||||||
|
github.com/mitchellh/go-homedir v0.0.0-20180801233206-58046073cbff
|
||||||
|
github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77
|
||||||
|
github.com/mitchellh/mapstructure v0.0.0-20180715050151-f15292f7a699
|
||||||
|
github.com/nicksnyder/go-i18n v0.0.0-20180803040939-a16b91a3ba80
|
||||||
|
github.com/nsf/termbox-go v0.0.0-20180613055208-5c94acc5e6eb
|
||||||
|
github.com/pelletier/go-buffruneio v0.2.0
|
||||||
|
github.com/pelletier/go-toml v1.2.0
|
||||||
|
github.com/pkg/errors v0.8.0
|
||||||
|
github.com/pmezard/go-difflib v1.0.0
|
||||||
|
github.com/sergi/go-diff v1.0.0
|
||||||
|
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0
|
||||||
|
github.com/sirupsen/logrus v1.0.6
|
||||||
|
github.com/spf13/afero v1.1.1
|
||||||
|
github.com/spf13/cast v1.2.0
|
||||||
|
github.com/spf13/jwalterweatherman v0.0.0-20180814060501-14d3d4c51834
|
||||||
|
github.com/spf13/pflag v1.0.2
|
||||||
|
github.com/spf13/viper v1.1.0
|
||||||
|
github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad
|
||||||
|
github.com/src-d/gcfg v1.3.0
|
||||||
|
github.com/stretchr/testify v1.2.2
|
||||||
|
github.com/stvp/roll v0.0.0-20170522205222-3627a5cbeaea
|
||||||
|
github.com/tcnksm/go-gitconfig v0.1.2
|
||||||
|
github.com/ulikunitz/xz v0.5.4
|
||||||
|
github.com/xanzy/ssh-agent v0.2.0
|
||||||
|
golang.org/x/crypto v0.0.0-20180808211826-de0752318171
|
||||||
|
golang.org/x/net v0.0.0-20180811021610-c39426892332
|
||||||
|
golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0
|
||||||
|
golang.org/x/text v0.3.0
|
||||||
|
gopkg.in/src-d/go-billy.v4 v4.2.0
|
||||||
|
gopkg.in/src-d/go-git.v4 v4.0.0-20180807092216-43d17e14b714
|
||||||
|
gopkg.in/warnings.v0 v0.1.2
|
||||||
|
gopkg.in/yaml.v2 v2.2.1
|
||||||
|
)
|
@ -10,11 +10,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (gui *Gui) handleBranchPress(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) handleBranchPress(g *gocui.Gui, v *gocui.View) error {
|
||||||
index := gui.getItemPosition(v)
|
index := gui.getItemPosition(gui.getBranchesView(g))
|
||||||
if index == 0 {
|
if index == 0 {
|
||||||
return gui.createErrorPanel(g, gui.Tr.SLocalize("AlreadyCheckedOutBranch"))
|
return gui.createErrorPanel(g, gui.Tr.SLocalize("AlreadyCheckedOutBranch"))
|
||||||
}
|
}
|
||||||
branch := gui.getSelectedBranch(v)
|
branch := gui.getSelectedBranch(gui.getBranchesView(g))
|
||||||
if err := gui.GitCommand.Checkout(branch.Name, false); err != nil {
|
if err := gui.GitCommand.Checkout(branch.Name, false); err != nil {
|
||||||
gui.createErrorPanel(g, err.Error())
|
gui.createErrorPanel(g, err.Error())
|
||||||
}
|
}
|
||||||
@ -115,16 +115,7 @@ func (gui *Gui) getSelectedBranch(v *gocui.View) commands.Branch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) renderBranchesOptions(g *gocui.Gui) error {
|
func (gui *Gui) renderBranchesOptions(g *gocui.Gui) error {
|
||||||
return gui.renderOptionsMap(g, map[string]string{
|
return gui.renderGlobalOptions(g)
|
||||||
"space": gui.Tr.SLocalize("checkout"),
|
|
||||||
"f": gui.Tr.SLocalize("forceCheckout"),
|
|
||||||
"m": gui.Tr.SLocalize("merge"),
|
|
||||||
"c": gui.Tr.SLocalize("checkoutByName"),
|
|
||||||
"n": gui.Tr.SLocalize("newBranch"),
|
|
||||||
"d": gui.Tr.SLocalize("deleteBranch"),
|
|
||||||
"D": gui.Tr.SLocalize("forceDeleteBranch"),
|
|
||||||
"← → ↑ ↓": gui.Tr.SLocalize("navigate"),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// may want to standardise how these select methods work
|
// may want to standardise how these select methods work
|
||||||
|
@ -59,13 +59,7 @@ func (gui *Gui) handleResetToCommit(g *gocui.Gui, commitView *gocui.View) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) renderCommitsOptions(g *gocui.Gui) error {
|
func (gui *Gui) renderCommitsOptions(g *gocui.Gui) error {
|
||||||
return gui.renderOptionsMap(g, map[string]string{
|
return gui.renderGlobalOptions(g)
|
||||||
"s": gui.Tr.SLocalize("squashDown"),
|
|
||||||
"r": gui.Tr.SLocalize("rename"),
|
|
||||||
"g": gui.Tr.SLocalize("resetToThisCommit"),
|
|
||||||
"f": gui.Tr.SLocalize("fixupCommit"),
|
|
||||||
"← → ↑ ↓": gui.Tr.SLocalize("navigate"),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleCommitSelect(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) handleCommitSelect(g *gocui.Gui, v *gocui.View) error {
|
||||||
@ -140,10 +134,10 @@ func (gui *Gui) handleCommitFixup(g *gocui.Gui, v *gocui.View) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleRenameCommit(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) handleRenameCommit(g *gocui.Gui, v *gocui.View) error {
|
||||||
if gui.getItemPosition(v) != 0 {
|
if gui.getItemPosition(gui.getCommitsView(g)) != 0 {
|
||||||
return gui.createErrorPanel(g, gui.Tr.SLocalize("OnlyRenameTopCommit"))
|
return gui.createErrorPanel(g, gui.Tr.SLocalize("OnlyRenameTopCommit"))
|
||||||
}
|
}
|
||||||
gui.createPromptPanel(g, v, gui.Tr.SLocalize("RenameCommit"), func(g *gocui.Gui, v *gocui.View) error {
|
return gui.createPromptPanel(g, v, gui.Tr.SLocalize("renameCommit"), func(g *gocui.Gui, v *gocui.View) error {
|
||||||
if err := gui.GitCommand.RenameCommit(v.Buffer()); err != nil {
|
if err := gui.GitCommand.RenameCommit(v.Buffer()); err != nil {
|
||||||
return gui.createErrorPanel(g, err.Error())
|
return gui.createErrorPanel(g, err.Error())
|
||||||
}
|
}
|
||||||
@ -156,7 +150,7 @@ func (gui *Gui) handleRenameCommit(g *gocui.Gui, v *gocui.View) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleRenameCommitEditor(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) handleRenameCommitEditor(g *gocui.Gui, v *gocui.View) error {
|
||||||
if gui.getItemPosition(v) != 0 {
|
if gui.getItemPosition(gui.getCommitsView(g)) != 0 {
|
||||||
return gui.createErrorPanel(g, gui.Tr.SLocalize("OnlyRenameTopCommit"))
|
return gui.createErrorPanel(g, gui.Tr.SLocalize("OnlyRenameTopCommit"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,31 +172,7 @@ func (gui *Gui) handleIgnoreFile(g *gocui.Gui, v *gocui.View) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) renderfilesOptions(g *gocui.Gui, file *commands.File) error {
|
func (gui *Gui) renderfilesOptions(g *gocui.Gui, file *commands.File) error {
|
||||||
optionsMap := map[string]string{
|
return gui.renderGlobalOptions(g)
|
||||||
"← → ↑ ↓": gui.Tr.SLocalize("navigate"),
|
|
||||||
"S": gui.Tr.SLocalize("stashFiles"),
|
|
||||||
"c": gui.Tr.SLocalize("CommitChanges"),
|
|
||||||
"o": gui.Tr.SLocalize("open"),
|
|
||||||
"i": gui.Tr.SLocalize("ignore"),
|
|
||||||
"d": gui.Tr.SLocalize("delete"),
|
|
||||||
"space": gui.Tr.SLocalize("toggleStaged"),
|
|
||||||
"R": gui.Tr.SLocalize("refresh"),
|
|
||||||
"t": gui.Tr.SLocalize("addPatch"),
|
|
||||||
"e": gui.Tr.SLocalize("edit"),
|
|
||||||
"a": gui.Tr.SLocalize("toggleStagedAll"),
|
|
||||||
"PgUp/PgDn": gui.Tr.SLocalize("scroll"),
|
|
||||||
}
|
|
||||||
if gui.State.HasMergeConflicts {
|
|
||||||
optionsMap["a"] = gui.Tr.SLocalize("abortMerge")
|
|
||||||
optionsMap["m"] = gui.Tr.SLocalize("resolveMergeConflicts")
|
|
||||||
}
|
|
||||||
if file == nil {
|
|
||||||
return gui.renderOptionsMap(g, optionsMap)
|
|
||||||
}
|
|
||||||
if file.Tracked {
|
|
||||||
optionsMap["d"] = gui.Tr.SLocalize("checkout")
|
|
||||||
}
|
|
||||||
return gui.renderOptionsMap(g, optionsMap)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleFileSelect(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) handleFileSelect(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
@ -83,6 +83,7 @@ type guiState struct {
|
|||||||
EditHistory *stack.Stack
|
EditHistory *stack.Stack
|
||||||
Platform commands.Platform
|
Platform commands.Platform
|
||||||
Updating bool
|
Updating bool
|
||||||
|
Keys []Binding
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGui builds a new gui handler
|
// NewGui builds a new gui handler
|
||||||
@ -346,6 +347,15 @@ func (gui *Gui) renderAppStatus(g *gocui.Gui) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) renderGlobalOptions(g *gocui.Gui) error {
|
||||||
|
return gui.renderOptionsMap(g, map[string]string{
|
||||||
|
"PgUp/PgDn": gui.Tr.SLocalize("scroll"),
|
||||||
|
"← → ↑ ↓": gui.Tr.SLocalize("navigate"),
|
||||||
|
"esc/q": gui.Tr.SLocalize("close"),
|
||||||
|
"x": gui.Tr.SLocalize("menu"),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (gui *Gui) goEvery(g *gocui.Gui, interval time.Duration, function func(*gocui.Gui) error) {
|
func (gui *Gui) goEvery(g *gocui.Gui, interval time.Duration, function func(*gocui.Gui) error) {
|
||||||
go func() {
|
go func() {
|
||||||
for range time.Tick(interval) {
|
for range time.Tick(interval) {
|
||||||
|
@ -6,75 +6,360 @@ import "github.com/jesseduffield/gocui"
|
|||||||
// is only handled if the given view has focus, or handled globally if the view
|
// is only handled if the given view has focus, or handled globally if the view
|
||||||
// is ""
|
// is ""
|
||||||
type Binding struct {
|
type Binding struct {
|
||||||
ViewName string
|
ViewName string
|
||||||
Handler func(*gocui.Gui, *gocui.View) error
|
Handler func(*gocui.Gui, *gocui.View) error
|
||||||
Key interface{} // FIXME: find out how to get `gocui.Key | rune`
|
Key interface{} // FIXME: find out how to get `gocui.Key | rune`
|
||||||
Modifier gocui.Modifier
|
Modifier gocui.Modifier
|
||||||
|
KeyReadable string
|
||||||
|
Description string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) keybindings(g *gocui.Gui) error {
|
func (gui *Gui) GetKeybindings() []Binding {
|
||||||
bindings := []Binding{
|
bindings := []Binding{
|
||||||
{ViewName: "", Key: 'q', Modifier: gocui.ModNone, Handler: gui.quit},
|
{
|
||||||
{ViewName: "", Key: gocui.KeyCtrlC, Modifier: gocui.ModNone, Handler: gui.quit},
|
ViewName: "",
|
||||||
{ViewName: "", Key: gocui.KeyEsc, Modifier: gocui.ModNone, Handler: gui.quit},
|
Key: 'q',
|
||||||
{ViewName: "", Key: gocui.KeyPgup, Modifier: gocui.ModNone, Handler: gui.scrollUpMain},
|
Modifier: gocui.ModNone,
|
||||||
{ViewName: "", Key: gocui.KeyPgdn, Modifier: gocui.ModNone, Handler: gui.scrollDownMain},
|
Handler: gui.quit,
|
||||||
{ViewName: "", Key: gocui.KeyCtrlU, Modifier: gocui.ModNone, Handler: gui.scrollUpMain},
|
}, {
|
||||||
{ViewName: "", Key: gocui.KeyCtrlD, Modifier: gocui.ModNone, Handler: gui.scrollDownMain},
|
ViewName: "",
|
||||||
{ViewName: "", Key: 'P', Modifier: gocui.ModNone, Handler: gui.pushFiles},
|
Key: gocui.KeyCtrlC,
|
||||||
{ViewName: "", Key: 'p', Modifier: gocui.ModNone, Handler: gui.pullFiles},
|
Modifier: gocui.ModNone,
|
||||||
{ViewName: "", Key: 'R', Modifier: gocui.ModNone, Handler: gui.handleRefresh},
|
Handler: gui.quit,
|
||||||
{ViewName: "status", Key: 'e', Modifier: gocui.ModNone, Handler: gui.handleEditConfig},
|
}, {
|
||||||
{ViewName: "status", Key: 'o', Modifier: gocui.ModNone, Handler: gui.handleOpenConfig},
|
ViewName: "",
|
||||||
{ViewName: "status", Key: 'u', Modifier: gocui.ModNone, Handler: gui.handleCheckForUpdate},
|
Key: gocui.KeyEsc,
|
||||||
{ViewName: "files", Key: 'c', Modifier: gocui.ModNone, Handler: gui.handleCommitPress},
|
Modifier: gocui.ModNone,
|
||||||
{ViewName: "files", Key: 'C', Modifier: gocui.ModNone, Handler: gui.handleCommitEditorPress},
|
Handler: gui.quit,
|
||||||
{ViewName: "files", Key: gocui.KeySpace, Modifier: gocui.ModNone, Handler: gui.handleFilePress},
|
}, {
|
||||||
{ViewName: "files", Key: 'd', Modifier: gocui.ModNone, Handler: gui.handleFileRemove},
|
ViewName: "",
|
||||||
{ViewName: "files", Key: 'm', Modifier: gocui.ModNone, Handler: gui.handleSwitchToMerge},
|
Key: gocui.KeyPgup,
|
||||||
{ViewName: "files", Key: 'e', Modifier: gocui.ModNone, Handler: gui.handleFileEdit},
|
Modifier: gocui.ModNone,
|
||||||
{ViewName: "files", Key: 'o', Modifier: gocui.ModNone, Handler: gui.handleFileOpen},
|
Handler: gui.scrollUpMain,
|
||||||
{ViewName: "files", Key: 'i', Modifier: gocui.ModNone, Handler: gui.handleIgnoreFile},
|
}, {
|
||||||
{ViewName: "files", Key: 'r', Modifier: gocui.ModNone, Handler: gui.handleRefreshFiles},
|
ViewName: "",
|
||||||
{ViewName: "files", Key: 'S', Modifier: gocui.ModNone, Handler: gui.handleStashSave},
|
Key: gocui.KeyPgdn,
|
||||||
{ViewName: "files", Key: 'A', Modifier: gocui.ModNone, Handler: gui.handleAbortMerge},
|
Modifier: gocui.ModNone,
|
||||||
{ViewName: "files", Key: 'a', Modifier: gocui.ModNone, Handler: gui.handleStageAll},
|
Handler: gui.scrollDownMain,
|
||||||
{ViewName: "files", Key: 't', Modifier: gocui.ModNone, Handler: gui.handleAddPatch},
|
}, {
|
||||||
{ViewName: "files", Key: 'D', Modifier: gocui.ModNone, Handler: gui.handleResetHard},
|
ViewName: "",
|
||||||
{ViewName: "main", Key: gocui.KeyEsc, Modifier: gocui.ModNone, Handler: gui.handleEscapeMerge},
|
Key: gocui.KeyCtrlU,
|
||||||
{ViewName: "main", Key: gocui.KeySpace, Modifier: gocui.ModNone, Handler: gui.handlePickHunk},
|
Modifier: gocui.ModNone,
|
||||||
{ViewName: "main", Key: 'b', Modifier: gocui.ModNone, Handler: gui.handlePickBothHunks},
|
Handler: gui.scrollUpMain,
|
||||||
{ViewName: "main", Key: gocui.KeyArrowLeft, Modifier: gocui.ModNone, Handler: gui.handleSelectPrevConflict},
|
}, {
|
||||||
{ViewName: "main", Key: gocui.KeyArrowRight, Modifier: gocui.ModNone, Handler: gui.handleSelectNextConflict},
|
ViewName: "",
|
||||||
{ViewName: "main", Key: gocui.KeyArrowUp, Modifier: gocui.ModNone, Handler: gui.handleSelectTop},
|
Key: gocui.KeyCtrlD,
|
||||||
{ViewName: "main", Key: gocui.KeyArrowDown, Modifier: gocui.ModNone, Handler: gui.handleSelectBottom},
|
Modifier: gocui.ModNone,
|
||||||
{ViewName: "main", Key: 'h', Modifier: gocui.ModNone, Handler: gui.handleSelectPrevConflict},
|
Handler: gui.scrollDownMain,
|
||||||
{ViewName: "main", Key: 'l', Modifier: gocui.ModNone, Handler: gui.handleSelectNextConflict},
|
}, {
|
||||||
{ViewName: "main", Key: 'k', Modifier: gocui.ModNone, Handler: gui.handleSelectTop},
|
ViewName: "",
|
||||||
{ViewName: "main", Key: 'j', Modifier: gocui.ModNone, Handler: gui.handleSelectBottom},
|
Key: 'P',
|
||||||
{ViewName: "main", Key: 'z', Modifier: gocui.ModNone, Handler: gui.handlePopFileSnapshot},
|
Modifier: gocui.ModNone,
|
||||||
{ViewName: "branches", Key: gocui.KeySpace, Modifier: gocui.ModNone, Handler: gui.handleBranchPress},
|
Handler: gui.pushFiles,
|
||||||
{ViewName: "branches", Key: 'c', Modifier: gocui.ModNone, Handler: gui.handleCheckoutByName},
|
Description: gui.Tr.SLocalize("push"),
|
||||||
{ViewName: "branches", Key: 'F', Modifier: gocui.ModNone, Handler: gui.handleForceCheckout},
|
}, {
|
||||||
{ViewName: "branches", Key: 'n', Modifier: gocui.ModNone, Handler: gui.handleNewBranch},
|
ViewName: "",
|
||||||
{ViewName: "branches", Key: 'd', Modifier: gocui.ModNone, Handler: gui.handleDeleteBranch},
|
Key: 'p',
|
||||||
{ViewName: "branches", Key: 'D', Modifier: gocui.ModNone, Handler: gui.handleForceDeleteBranch},
|
Modifier: gocui.ModNone,
|
||||||
{ViewName: "branches", Key: 'm', Modifier: gocui.ModNone, Handler: gui.handleMerge},
|
Handler: gui.pullFiles,
|
||||||
{ViewName: "commits", Key: 's', Modifier: gocui.ModNone, Handler: gui.handleCommitSquashDown},
|
Description: gui.Tr.SLocalize("pull"),
|
||||||
{ViewName: "commits", Key: 'r', Modifier: gocui.ModNone, Handler: gui.handleRenameCommit},
|
}, {
|
||||||
{ViewName: "commits", Key: 'R', Modifier: gocui.ModNone, Handler: gui.handleRenameCommitEditor},
|
ViewName: "",
|
||||||
{ViewName: "commits", Key: 'g', Modifier: gocui.ModNone, Handler: gui.handleResetToCommit},
|
Key: 'R',
|
||||||
{ViewName: "commits", Key: 'f', Modifier: gocui.ModNone, Handler: gui.handleCommitFixup},
|
Modifier: gocui.ModNone,
|
||||||
{ViewName: "stash", Key: gocui.KeySpace, Modifier: gocui.ModNone, Handler: gui.handleStashApply},
|
Handler: gui.handleRefresh,
|
||||||
{ViewName: "stash", Key: 'g', Modifier: gocui.ModNone, Handler: gui.handleStashPop},
|
Description: gui.Tr.SLocalize("refresh"),
|
||||||
{ViewName: "stash", Key: 'd', Modifier: gocui.ModNone, Handler: gui.handleStashDrop},
|
}, {
|
||||||
{ViewName: "commitMessage", Key: gocui.KeyEnter, Modifier: gocui.ModNone, Handler: gui.handleCommitConfirm},
|
ViewName: "",
|
||||||
{ViewName: "commitMessage", Key: gocui.KeyEsc, Modifier: gocui.ModNone, Handler: gui.handleCommitClose},
|
Key: 'x',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleMenu,
|
||||||
|
}, {
|
||||||
|
ViewName: "status",
|
||||||
|
Key: 'e',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleEditConfig,
|
||||||
|
Description: gui.Tr.SLocalize("EditConfig"),
|
||||||
|
}, {
|
||||||
|
ViewName: "status",
|
||||||
|
Key: 'o',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleOpenConfig,
|
||||||
|
Description: gui.Tr.SLocalize("OpenConfig"),
|
||||||
|
}, {
|
||||||
|
ViewName: "status",
|
||||||
|
Key: 'u',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleCheckForUpdate,
|
||||||
|
Description: gui.Tr.SLocalize("checkForUpdate"),
|
||||||
|
}, {
|
||||||
|
ViewName: "files",
|
||||||
|
Key: 'c',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleCommitPress,
|
||||||
|
Description: gui.Tr.SLocalize("CommitChanges"),
|
||||||
|
}, {
|
||||||
|
ViewName: "files",
|
||||||
|
Key: 'C',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleCommitEditorPress,
|
||||||
|
Description: gui.Tr.SLocalize("CommitChangesWithEditor"),
|
||||||
|
}, {
|
||||||
|
ViewName: "files",
|
||||||
|
Key: gocui.KeySpace,
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleFilePress,
|
||||||
|
KeyReadable: "space",
|
||||||
|
Description: gui.Tr.SLocalize("toggleStaged"),
|
||||||
|
}, {
|
||||||
|
ViewName: "files",
|
||||||
|
Key: 'd',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleFileRemove,
|
||||||
|
Description: gui.Tr.SLocalize("removeFile"),
|
||||||
|
}, {
|
||||||
|
ViewName: "files",
|
||||||
|
Key: 'm',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleSwitchToMerge,
|
||||||
|
Description: gui.Tr.SLocalize("resolveMergeConflicts"),
|
||||||
|
}, {
|
||||||
|
ViewName: "files",
|
||||||
|
Key: 'e',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleFileEdit,
|
||||||
|
Description: gui.Tr.SLocalize("editFile"),
|
||||||
|
}, {
|
||||||
|
ViewName: "files",
|
||||||
|
Key: 'o',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleFileOpen,
|
||||||
|
Description: gui.Tr.SLocalize("openFile"),
|
||||||
|
}, {
|
||||||
|
ViewName: "files",
|
||||||
|
Key: 'i',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleIgnoreFile,
|
||||||
|
Description: gui.Tr.SLocalize("ignoreFile"),
|
||||||
|
}, {
|
||||||
|
ViewName: "files",
|
||||||
|
Key: 'r',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleRefreshFiles,
|
||||||
|
Description: gui.Tr.SLocalize("refreshFiles"),
|
||||||
|
}, {
|
||||||
|
ViewName: "files",
|
||||||
|
Key: 'S',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleStashSave,
|
||||||
|
Description: gui.Tr.SLocalize("stashFiles"),
|
||||||
|
}, {
|
||||||
|
ViewName: "files",
|
||||||
|
Key: 'A',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleAbortMerge,
|
||||||
|
Description: gui.Tr.SLocalize("abortMerge"),
|
||||||
|
}, {
|
||||||
|
ViewName: "files",
|
||||||
|
Key: 'a',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleStageAll,
|
||||||
|
Description: gui.Tr.SLocalize("toggleStagedAll"),
|
||||||
|
}, {
|
||||||
|
ViewName: "files",
|
||||||
|
Key: 't',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleAddPatch,
|
||||||
|
Description: gui.Tr.SLocalize("addPatch"),
|
||||||
|
}, {
|
||||||
|
ViewName: "files",
|
||||||
|
Key: 'D',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleResetHard,
|
||||||
|
Description: gui.Tr.SLocalize("resetHard"),
|
||||||
|
}, {
|
||||||
|
ViewName: "main",
|
||||||
|
Key: gocui.KeyEsc,
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleEscapeMerge,
|
||||||
|
}, {
|
||||||
|
ViewName: "main",
|
||||||
|
Key: gocui.KeySpace,
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handlePickHunk,
|
||||||
|
}, {
|
||||||
|
ViewName: "main",
|
||||||
|
Key: 'b',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handlePickBothHunks,
|
||||||
|
}, {
|
||||||
|
ViewName: "main",
|
||||||
|
Key: gocui.KeyArrowLeft,
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleSelectPrevConflict,
|
||||||
|
}, {
|
||||||
|
ViewName: "main",
|
||||||
|
Key: gocui.KeyArrowRight,
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleSelectNextConflict,
|
||||||
|
}, {
|
||||||
|
ViewName: "main",
|
||||||
|
Key: gocui.KeyArrowUp,
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleSelectTop,
|
||||||
|
}, {
|
||||||
|
ViewName: "main",
|
||||||
|
Key: gocui.KeyArrowDown,
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleSelectBottom,
|
||||||
|
}, {
|
||||||
|
ViewName: "main",
|
||||||
|
Key: 'h',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleSelectPrevConflict,
|
||||||
|
}, {
|
||||||
|
ViewName: "main",
|
||||||
|
Key: 'l',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleSelectNextConflict,
|
||||||
|
}, {
|
||||||
|
ViewName: "main",
|
||||||
|
Key: 'k',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleSelectTop,
|
||||||
|
}, {
|
||||||
|
ViewName: "main",
|
||||||
|
Key: 'j',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleSelectBottom,
|
||||||
|
}, {
|
||||||
|
ViewName: "main",
|
||||||
|
Key: 'z',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handlePopFileSnapshot,
|
||||||
|
}, {
|
||||||
|
ViewName: "branches",
|
||||||
|
Key: gocui.KeySpace,
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleBranchPress,
|
||||||
|
KeyReadable: "space",
|
||||||
|
Description: gui.Tr.SLocalize("checkout"),
|
||||||
|
}, {
|
||||||
|
ViewName: "branches",
|
||||||
|
Key: 'c',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleCheckoutByName,
|
||||||
|
Description: gui.Tr.SLocalize("checkoutByName"),
|
||||||
|
}, {
|
||||||
|
ViewName: "branches",
|
||||||
|
Key: 'F',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleForceCheckout,
|
||||||
|
Description: gui.Tr.SLocalize("forceCheckout"),
|
||||||
|
}, {
|
||||||
|
ViewName: "branches",
|
||||||
|
Key: 'n',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleNewBranch,
|
||||||
|
Description: gui.Tr.SLocalize("newBranch"),
|
||||||
|
}, {
|
||||||
|
ViewName: "branches",
|
||||||
|
Key: 'd',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleDeleteBranch,
|
||||||
|
Description: gui.Tr.SLocalize("deleteBranch"),
|
||||||
|
}, {
|
||||||
|
ViewName: "branches",
|
||||||
|
Key: 'D',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleForceDeleteBranch,
|
||||||
|
Description: gui.Tr.SLocalize("forceDeleteBranch"),
|
||||||
|
}, {
|
||||||
|
ViewName: "branches",
|
||||||
|
Key: 'm',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleMerge,
|
||||||
|
Description: gui.Tr.SLocalize("mergeIntoCurrentBranch"),
|
||||||
|
}, {
|
||||||
|
ViewName: "commits",
|
||||||
|
Key: 's',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleCommitSquashDown,
|
||||||
|
Description: gui.Tr.SLocalize("squashDown"),
|
||||||
|
}, {
|
||||||
|
ViewName: "commits",
|
||||||
|
Key: 'r',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleRenameCommit,
|
||||||
|
Description: gui.Tr.SLocalize("renameCommit"),
|
||||||
|
}, {
|
||||||
|
ViewName: "commits",
|
||||||
|
Key: 'R',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleRenameCommitEditor,
|
||||||
|
Description: gui.Tr.SLocalize("renameCommitEditor"),
|
||||||
|
}, {
|
||||||
|
ViewName: "commits",
|
||||||
|
Key: 'g',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleResetToCommit,
|
||||||
|
Description: gui.Tr.SLocalize("resetToThisCommit"),
|
||||||
|
}, {
|
||||||
|
ViewName: "commits",
|
||||||
|
Key: 'f',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleCommitFixup,
|
||||||
|
Description: gui.Tr.SLocalize("fixupCommit"),
|
||||||
|
}, {
|
||||||
|
ViewName: "stash",
|
||||||
|
Key: gocui.KeySpace,
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleStashApply,
|
||||||
|
KeyReadable: "space",
|
||||||
|
Description: gui.Tr.SLocalize("apply"),
|
||||||
|
}, {
|
||||||
|
ViewName: "stash",
|
||||||
|
Key: 'g',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleStashPop,
|
||||||
|
Description: gui.Tr.SLocalize("pop"),
|
||||||
|
}, {
|
||||||
|
ViewName: "stash",
|
||||||
|
Key: 'd',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleStashDrop,
|
||||||
|
Description: gui.Tr.SLocalize("drop"),
|
||||||
|
}, {
|
||||||
|
ViewName: "commitMessage",
|
||||||
|
Key: gocui.KeyEnter,
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleCommitConfirm,
|
||||||
|
}, {
|
||||||
|
ViewName: "commitMessage",
|
||||||
|
Key: gocui.KeyEsc,
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleCommitClose,
|
||||||
|
}, {
|
||||||
|
ViewName: "menu",
|
||||||
|
Key: gocui.KeyEsc,
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleMenuClose,
|
||||||
|
}, {
|
||||||
|
ViewName: "menu",
|
||||||
|
Key: 'q',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleMenuClose,
|
||||||
|
}, {
|
||||||
|
ViewName: "menu",
|
||||||
|
Key: gocui.KeySpace,
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleMenuPress,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Would make these keybindings global but that interferes with editing
|
// Would make these keybindings global but that interferes with editing
|
||||||
// input in the confirmation panel
|
// input in the confirmation panel
|
||||||
for _, viewName := range []string{"status", "files", "branches", "commits", "stash"} {
|
for _, viewName := range []string{"status", "files", "branches", "commits", "stash", "menu"} {
|
||||||
bindings = append(bindings, []Binding{
|
bindings = append(bindings, []Binding{
|
||||||
{ViewName: viewName, Key: gocui.KeyTab, Modifier: gocui.ModNone, Handler: gui.nextView},
|
{ViewName: viewName, Key: gocui.KeyTab, Modifier: gocui.ModNone, Handler: gui.nextView},
|
||||||
{ViewName: viewName, Key: gocui.KeyArrowLeft, Modifier: gocui.ModNone, Handler: gui.previousView},
|
{ViewName: viewName, Key: gocui.KeyArrowLeft, Modifier: gocui.ModNone, Handler: gui.previousView},
|
||||||
@ -88,6 +373,12 @@ func (gui *Gui) keybindings(g *gocui.Gui) error {
|
|||||||
}...)
|
}...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return bindings
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) keybindings(g *gocui.Gui) error {
|
||||||
|
bindings := gui.GetKeybindings()
|
||||||
|
|
||||||
for _, binding := range bindings {
|
for _, binding := range bindings {
|
||||||
if err := g.SetKeybinding(binding.ViewName, binding.Key, binding.Modifier, binding.Handler); err != nil {
|
if err := g.SetKeybinding(binding.ViewName, binding.Key, binding.Modifier, binding.Handler); err != nil {
|
||||||
return err
|
return err
|
||||||
|
131
pkg/gui/menu_panel.go
Normal file
131
pkg/gui/menu_panel.go
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
package gui
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/jesseduffield/gocui"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (gui *Gui) handleMenuPress(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
lineNumber := gui.getItemPosition(v)
|
||||||
|
if gui.State.Keys[lineNumber].Key == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if len(gui.State.Keys) > lineNumber {
|
||||||
|
err := gui.handleMenuClose(g, v)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return gui.State.Keys[lineNumber].Handler(g, v)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) handleMenuSelect(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
// doing nothing for now
|
||||||
|
// but it is needed for switch in newLineFocused
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) renderMenuOptions(g *gocui.Gui) error {
|
||||||
|
optionsMap := map[string]string{
|
||||||
|
"esc/q": gui.Tr.SLocalize("close"),
|
||||||
|
"↑ ↓": gui.Tr.SLocalize("navigate"),
|
||||||
|
"space": gui.Tr.SLocalize("execute"),
|
||||||
|
}
|
||||||
|
return gui.renderOptionsMap(g, optionsMap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) handleMenuClose(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
// better to delete because for example after closing update confirmation panel,
|
||||||
|
// the focus isn't set back to any of panels and one is unable to even quit
|
||||||
|
//_, err := g.SetViewOnBottom(v.Name())
|
||||||
|
err := g.DeleteView("menu")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return gui.returnFocus(g, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) GetKey(binding Binding) string {
|
||||||
|
r, ok := binding.Key.(rune)
|
||||||
|
key := ""
|
||||||
|
|
||||||
|
if ok {
|
||||||
|
key = string(r)
|
||||||
|
} else if binding.KeyReadable != "" {
|
||||||
|
key = binding.KeyReadable
|
||||||
|
}
|
||||||
|
|
||||||
|
return key
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) GetMaxKeyLength(bindings []Binding) int {
|
||||||
|
max := 0
|
||||||
|
for _, binding := range bindings {
|
||||||
|
keyLength := len(gui.GetKey(binding))
|
||||||
|
if keyLength > max {
|
||||||
|
max = keyLength
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return max
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) handleMenu(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
var (
|
||||||
|
contentGlobal, contentPanel []string
|
||||||
|
bindingsGlobal, bindingsPanel []Binding
|
||||||
|
)
|
||||||
|
// clear keys slice, so we don't have ghost elements
|
||||||
|
gui.State.Keys = gui.State.Keys[:0]
|
||||||
|
bindings := gui.GetKeybindings()
|
||||||
|
padWidth := gui.GetMaxKeyLength(bindings)
|
||||||
|
|
||||||
|
for _, binding := range bindings {
|
||||||
|
key := gui.GetKey(binding)
|
||||||
|
if key != "" && binding.Description != "" {
|
||||||
|
content := fmt.Sprintf("%s %s", utils.WithPadding(key, padWidth), binding.Description)
|
||||||
|
switch binding.ViewName {
|
||||||
|
case "":
|
||||||
|
contentGlobal = append(contentGlobal, content)
|
||||||
|
bindingsGlobal = append(bindingsGlobal, binding)
|
||||||
|
case v.Name():
|
||||||
|
contentPanel = append(contentPanel, content)
|
||||||
|
bindingsPanel = append(bindingsPanel, binding)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// append dummy element to have a separator between
|
||||||
|
// panel and global keybindings
|
||||||
|
contentPanel = append(contentPanel, "")
|
||||||
|
bindingsPanel = append(bindingsPanel, Binding{})
|
||||||
|
|
||||||
|
content := append(contentPanel, contentGlobal...)
|
||||||
|
gui.State.Keys = append(bindingsPanel, bindingsGlobal...)
|
||||||
|
// append newline at the end so the last line would be selectable
|
||||||
|
contentJoined := strings.Join(content, "\n") + "\n"
|
||||||
|
|
||||||
|
// y1-1 so there will not be an extra space at the end of panel
|
||||||
|
x0, y0, x1, y1 := gui.getConfirmationPanelDimensions(g, contentJoined)
|
||||||
|
menuView, _ := g.SetView("menu", x0, y0, x1, y1-1, 0)
|
||||||
|
menuView.Title = strings.Title(gui.Tr.SLocalize("menu"))
|
||||||
|
menuView.FgColor = gocui.ColorWhite
|
||||||
|
|
||||||
|
if err := gui.renderMenuOptions(g); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Fprint(menuView, contentJoined)
|
||||||
|
|
||||||
|
g.Update(func(g *gocui.Gui) error {
|
||||||
|
_, err := g.SetViewOnTop("menu")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return gui.switchFocus(g, v, menuView)
|
||||||
|
})
|
||||||
|
return nil
|
||||||
|
}
|
@ -27,17 +27,13 @@ func (gui *Gui) getSelectedStashEntry(v *gocui.View) *commands.StashEntry {
|
|||||||
if len(gui.State.StashEntries) == 0 {
|
if len(gui.State.StashEntries) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
lineNumber := gui.getItemPosition(v)
|
stashView, _ := gui.g.View("stash")
|
||||||
|
lineNumber := gui.getItemPosition(stashView)
|
||||||
return &gui.State.StashEntries[lineNumber]
|
return &gui.State.StashEntries[lineNumber]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) renderStashOptions(g *gocui.Gui) error {
|
func (gui *Gui) renderStashOptions(g *gocui.Gui) error {
|
||||||
return gui.renderOptionsMap(g, map[string]string{
|
return gui.renderGlobalOptions(g)
|
||||||
"space": gui.Tr.SLocalize("apply"),
|
|
||||||
"g": gui.Tr.SLocalize("pop"),
|
|
||||||
"d": gui.Tr.SLocalize("drop"),
|
|
||||||
"← → ↑ ↓": gui.Tr.SLocalize("navigate"),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleStashEntrySelect(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) handleStashEntrySelect(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
@ -42,11 +42,7 @@ func (gui *Gui) refreshStatus(g *gocui.Gui) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) renderStatusOptions(g *gocui.Gui) error {
|
func (gui *Gui) renderStatusOptions(g *gocui.Gui) error {
|
||||||
return gui.renderOptionsMap(g, map[string]string{
|
return gui.renderGlobalOptions(g)
|
||||||
"o": gui.Tr.SLocalize("OpenConfig"),
|
|
||||||
"e": gui.Tr.SLocalize("EditConfig"),
|
|
||||||
"u": gui.Tr.SLocalize("CheckForUpdate"),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleCheckForUpdate(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) handleCheckForUpdate(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
@ -82,6 +82,8 @@ func (gui *Gui) newLineFocused(g *gocui.Gui, v *gocui.View) error {
|
|||||||
mainView.SetOrigin(0, 0)
|
mainView.SetOrigin(0, 0)
|
||||||
|
|
||||||
switch v.Name() {
|
switch v.Name() {
|
||||||
|
case "menu":
|
||||||
|
return gui.handleMenuSelect(g, v)
|
||||||
case "status":
|
case "status":
|
||||||
return gui.handleStatusSelect(g, v)
|
return gui.handleStatusSelect(g, v)
|
||||||
case "files":
|
case "files":
|
||||||
@ -145,6 +147,7 @@ func (gui *Gui) switchFocus(g *gocui.Gui, oldView, newView *gocui.View) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
g.Cursor = newView.Editable
|
g.Cursor = newView.Editable
|
||||||
|
|
||||||
return gui.newLineFocused(g, newView)
|
return gui.newLineFocused(g, newView)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,6 +248,7 @@ func (gui *Gui) renderOptionsMap(g *gocui.Gui, optionsMap map[string]string) err
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: refactor properly
|
// TODO: refactor properly
|
||||||
|
// i'm so sorry but had to add this getBranchesView
|
||||||
func (gui *Gui) getFilesView(g *gocui.Gui) *gocui.View {
|
func (gui *Gui) getFilesView(g *gocui.Gui) *gocui.View {
|
||||||
v, _ := g.View("files")
|
v, _ := g.View("files")
|
||||||
return v
|
return v
|
||||||
@ -260,6 +264,11 @@ func (gui *Gui) getCommitMessageView(g *gocui.Gui) *gocui.View {
|
|||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) getBranchesView(g *gocui.Gui) *gocui.View {
|
||||||
|
v, _ := g.View("branches")
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
func (gui *Gui) trimmedContent(v *gocui.View) string {
|
func (gui *Gui) trimmedContent(v *gocui.View) string {
|
||||||
return strings.TrimSpace(v.Buffer())
|
return strings.TrimSpace(v.Buffer())
|
||||||
}
|
}
|
||||||
|
@ -34,12 +34,24 @@ func addDutch(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "CommitChanges",
|
ID: "CommitChanges",
|
||||||
Other: "Commit Veranderingen",
|
Other: "Commit Veranderingen",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "CommitChangesWithEditor",
|
||||||
|
Other: "commit changes using git editor",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "StatusTitle",
|
ID: "StatusTitle",
|
||||||
Other: "Status",
|
Other: "Status",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "GlobalTitle",
|
||||||
|
Other: "Global",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "navigate",
|
ID: "navigate",
|
||||||
Other: "navigeer",
|
Other: "navigeer",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "menu",
|
||||||
|
Other: "menu",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "execute",
|
||||||
|
Other: "execute",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "stashFiles",
|
ID: "stashFiles",
|
||||||
Other: "stash-bestanden",
|
Other: "stash-bestanden",
|
||||||
@ -172,6 +184,9 @@ func addDutch(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "CloseConfirm",
|
ID: "CloseConfirm",
|
||||||
Other: "{{.keyBindClose}}: Sluiten, {{.keyBindConfirm}}: Bevestigen",
|
Other: "{{.keyBindClose}}: Sluiten, {{.keyBindConfirm}}: Bevestigen",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "close",
|
||||||
|
Other: "close",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "SureResetThisCommit",
|
ID: "SureResetThisCommit",
|
||||||
Other: "Weet je het zeker dat je wil resetten naar deze commit?",
|
Other: "Weet je het zeker dat je wil resetten naar deze commit?",
|
||||||
@ -212,8 +227,11 @@ func addDutch(i18nObject *i18n.Bundle) error {
|
|||||||
ID: "OnlyRenameTopCommit",
|
ID: "OnlyRenameTopCommit",
|
||||||
Other: "Je kan alleen de bovenste commit hernoemen",
|
Other: "Je kan alleen de bovenste commit hernoemen",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "RenameCommit",
|
ID: "renameCommit",
|
||||||
Other: "Hernoem Commit",
|
Other: "hernoem commit",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "renameCommitEditor",
|
||||||
|
Other: "rename commit with editor",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "PotentialErrInGetselectedCommit",
|
ID: "PotentialErrInGetselectedCommit",
|
||||||
Other: "Er is mogelijk een error in getSelected Commit (geen match tussen ui en state)",
|
Other: "Er is mogelijk een error in getSelected Commit (geen match tussen ui en state)",
|
||||||
@ -295,6 +313,60 @@ func addDutch(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "MergeAborted",
|
ID: "MergeAborted",
|
||||||
Other: "Merge afgebroken",
|
Other: "Merge afgebroken",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "OpenConfig",
|
||||||
|
Other: "open config file",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "EditConfig",
|
||||||
|
Other: "edit config file",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "ForcePush",
|
||||||
|
Other: "Force push",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "ForcePushPrompt",
|
||||||
|
Other: "Your branch has diverged from the remote branch. Press 'esc' to cancel, or 'enter' to force push.",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "checkForUpdate",
|
||||||
|
Other: "check for update",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "CheckingForUpdates",
|
||||||
|
Other: "Checking for updates...",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "OnLatestVersionErr",
|
||||||
|
Other: "You already have the latest version",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "MajorVersionErr",
|
||||||
|
Other: "New version ({{.newVersion}}) has non-backwards compatible changes compared to the current version ({{.currentVersion}})",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "CouldNotFindBinaryErr",
|
||||||
|
Other: "Could not find any binary at {{.url}}",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "AnonymousReportingTitle",
|
||||||
|
Other: "Help make lazygit better",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "AnonymousReportingPrompt",
|
||||||
|
Other: "Would you like to enable anonymous reporting data to help improve lazygit? (enter/esc)",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "removeFile",
|
||||||
|
Other: `delete if untracked / checkout if tracked (aka go away)`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "editFile",
|
||||||
|
Other: `edit file`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "openFile",
|
||||||
|
Other: `open file`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "ignoreFile",
|
||||||
|
Other: `add to .gitignore`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "refreshFiles",
|
||||||
|
Other: `refresh files`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "resetHard",
|
||||||
|
Other: `reset hard`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "mergeIntoCurrentBranch",
|
||||||
|
Other: `merge into currently checked out branch`,
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "ConfirmQuit",
|
ID: "ConfirmQuit",
|
||||||
Other: `Are you sure you want to quit?`,
|
Other: `Are you sure you want to quit?`,
|
||||||
|
@ -42,12 +42,24 @@ func addEnglish(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "CommitChanges",
|
ID: "CommitChanges",
|
||||||
Other: "commit changes",
|
Other: "commit changes",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "CommitChangesWithEditor",
|
||||||
|
Other: "commit changes using git editor",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "StatusTitle",
|
ID: "StatusTitle",
|
||||||
Other: "Status",
|
Other: "Status",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "GlobalTitle",
|
||||||
|
Other: "Global",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "navigate",
|
ID: "navigate",
|
||||||
Other: "navigate",
|
Other: "navigate",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "menu",
|
||||||
|
Other: "menu",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "execute",
|
||||||
|
Other: "execute",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "stashFiles",
|
ID: "stashFiles",
|
||||||
Other: "stash files",
|
Other: "stash files",
|
||||||
@ -69,6 +81,12 @@ func addEnglish(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "refresh",
|
ID: "refresh",
|
||||||
Other: "refresh",
|
Other: "refresh",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "push",
|
||||||
|
Other: "push",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "pull",
|
||||||
|
Other: "pull",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "addPatch",
|
ID: "addPatch",
|
||||||
Other: "add patch",
|
Other: "add patch",
|
||||||
@ -183,6 +201,9 @@ func addEnglish(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "CloseConfirm",
|
ID: "CloseConfirm",
|
||||||
Other: "{{.keyBindClose}}: close, {{.keyBindConfirm}}: confirm",
|
Other: "{{.keyBindClose}}: close, {{.keyBindConfirm}}: confirm",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "close",
|
||||||
|
Other: "close",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "SureResetThisCommit",
|
ID: "SureResetThisCommit",
|
||||||
Other: "Are you sure you want to reset to this commit?",
|
Other: "Are you sure you want to reset to this commit?",
|
||||||
@ -223,8 +244,11 @@ func addEnglish(i18nObject *i18n.Bundle) error {
|
|||||||
ID: "OnlyRenameTopCommit",
|
ID: "OnlyRenameTopCommit",
|
||||||
Other: "Can only rename topmost commit",
|
Other: "Can only rename topmost commit",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "RenameCommit",
|
ID: "renameCommit",
|
||||||
Other: "Rename Commit",
|
Other: "rename commit",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "renameCommitEditor",
|
||||||
|
Other: "rename commit with editor",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "PotentialErrInGetselectedCommit",
|
ID: "PotentialErrInGetselectedCommit",
|
||||||
Other: "potential error in getSelected Commit (mismatched ui and state)",
|
Other: "potential error in getSelected Commit (mismatched ui and state)",
|
||||||
@ -319,8 +343,8 @@ func addEnglish(i18nObject *i18n.Bundle) error {
|
|||||||
ID: "ForcePushPrompt",
|
ID: "ForcePushPrompt",
|
||||||
Other: "Your branch has diverged from the remote branch. Press 'esc' to cancel, or 'enter' to force push.",
|
Other: "Your branch has diverged from the remote branch. Press 'esc' to cancel, or 'enter' to force push.",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "CheckForUpdate",
|
ID: "checkForUpdate",
|
||||||
Other: "Check for update",
|
Other: "check for update",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "CheckingForUpdates",
|
ID: "CheckingForUpdates",
|
||||||
Other: "Checking for updates...",
|
Other: "Checking for updates...",
|
||||||
@ -342,6 +366,27 @@ func addEnglish(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "GitconfigParseErr",
|
ID: "GitconfigParseErr",
|
||||||
Other: `Gogit failed to parse your gitconfig file due to the presence of unquoted '\' characters. Removing these should fix the issue.`,
|
Other: `Gogit failed to parse your gitconfig file due to the presence of unquoted '\' characters. Removing these should fix the issue.`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "removeFile",
|
||||||
|
Other: `delete if untracked / checkout if tracked`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "editFile",
|
||||||
|
Other: `edit file`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "openFile",
|
||||||
|
Other: `open file`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "ignoreFile",
|
||||||
|
Other: `add to .gitignore`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "refreshFiles",
|
||||||
|
Other: `refresh files`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "resetHard",
|
||||||
|
Other: `reset hard`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "mergeIntoCurrentBranch",
|
||||||
|
Other: `merge into currently checked out branch`,
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "ConfirmQuit",
|
ID: "ConfirmQuit",
|
||||||
Other: `Are you sure you want to quit?`,
|
Other: `Are you sure you want to quit?`,
|
||||||
|
@ -32,12 +32,24 @@ func addPolish(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "CommitChanges",
|
ID: "CommitChanges",
|
||||||
Other: "commituj zmiany",
|
Other: "commituj zmiany",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "CommitChangesWithEditor",
|
||||||
|
Other: "commituj zmiany używając edytora z gita",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "StatusTitle",
|
ID: "StatusTitle",
|
||||||
Other: "Status",
|
Other: "Status",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "GlobalTitle",
|
||||||
|
Other: "Globalne",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "navigate",
|
ID: "navigate",
|
||||||
Other: "nawiguj",
|
Other: "nawiguj",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "menu",
|
||||||
|
Other: "menu",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "execute",
|
||||||
|
Other: "wykonaj",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "stashFiles",
|
ID: "stashFiles",
|
||||||
Other: "przechowaj pliki",
|
Other: "przechowaj pliki",
|
||||||
@ -134,6 +146,9 @@ func addPolish(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "DeleteBranchMessage",
|
ID: "DeleteBranchMessage",
|
||||||
Other: "Jesteś pewien, że chcesz usunąć gałąź {{.selectedBranchName}} ?",
|
Other: "Jesteś pewien, że chcesz usunąć gałąź {{.selectedBranchName}} ?",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "ForceDeleteBranchMessage",
|
||||||
|
Other: "Na pewno wymusić usunięcie gałęzi {{.selectedBranchName}}?",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "CantMergeBranchIntoItself",
|
ID: "CantMergeBranchIntoItself",
|
||||||
Other: "Nie możesz scalić gałęzi do samej siebie",
|
Other: "Nie możesz scalić gałęzi do samej siebie",
|
||||||
@ -152,6 +167,9 @@ func addPolish(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "deleteBranch",
|
ID: "deleteBranch",
|
||||||
Other: "usuń gałąź",
|
Other: "usuń gałąź",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "forceDeleteBranch",
|
||||||
|
Other: "usuń gałąź (wymuś)",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "NoBranchesThisRepo",
|
ID: "NoBranchesThisRepo",
|
||||||
Other: "Brak gałęzi dla tego repozytorium",
|
Other: "Brak gałęzi dla tego repozytorium",
|
||||||
@ -164,6 +182,9 @@ func addPolish(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "CloseConfirm",
|
ID: "CloseConfirm",
|
||||||
Other: "{{.keyBindClose}}: zamknij, {{.keyBindConfirm}}: potwierdź",
|
Other: "{{.keyBindClose}}: zamknij, {{.keyBindConfirm}}: potwierdź",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "close",
|
||||||
|
Other: "zamknij",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "SureResetThisCommit",
|
ID: "SureResetThisCommit",
|
||||||
Other: "Jesteś pewny, że chcesz zresetować ten commit?",
|
Other: "Jesteś pewny, że chcesz zresetować ten commit?",
|
||||||
@ -204,8 +225,11 @@ func addPolish(i18nObject *i18n.Bundle) error {
|
|||||||
ID: "OnlyRenameTopCommit",
|
ID: "OnlyRenameTopCommit",
|
||||||
Other: "Można przmianować tylko najwyższy commit",
|
Other: "Można przmianować tylko najwyższy commit",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "RenameCommit",
|
ID: "renameCommit",
|
||||||
Other: "Przemianuj commit",
|
Other: "przemianuj commit",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "renameCommitEditor",
|
||||||
|
Other: "przemianuj commit w edytorze",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "PotentialErrInGetselectedCommit",
|
ID: "PotentialErrInGetselectedCommit",
|
||||||
Other: "potencjalny błąd w getSelected Commit (niedopasowane ui i stan)",
|
Other: "potencjalny błąd w getSelected Commit (niedopasowane ui i stan)",
|
||||||
@ -287,6 +311,60 @@ func addPolish(i18nObject *i18n.Bundle) error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "MergeAborted",
|
ID: "MergeAborted",
|
||||||
Other: "Scalanie anulowane",
|
Other: "Scalanie anulowane",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "OpenConfig",
|
||||||
|
Other: "otwórz plik konfiguracyjny",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "EditConfig",
|
||||||
|
Other: "edytuj plik konfiguracyjny",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "ForcePush",
|
||||||
|
Other: "Wymuś wypchnięcie",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "ForcePushPrompt",
|
||||||
|
Other: "Twoja gałąź rozeszła się z gałęzią zdalną. Wciśnij 'esc' aby anulować lub 'enter' aby wymusić wypchnięcie.",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "checkForUpdate",
|
||||||
|
Other: "sprawdź aktualizacje",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "CheckingForUpdates",
|
||||||
|
Other: "Sprawdzanie aktualizacji...",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "OnLatestVersionErr",
|
||||||
|
Other: "Już posiadasz najnowszą wersję",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "MajorVersionErr",
|
||||||
|
Other: "Nowa wersja ({{.newVersion}}) posiada niekompatybilne zmiany w porównaniu do obecnej wersji ({{.currentVersion}})",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "CouldNotFindBinaryErr",
|
||||||
|
Other: "Nie można znaleźć pliku binarnego w {{.url}}",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "AnonymousReportingTitle",
|
||||||
|
Other: "Help make lazygit better",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "AnonymousReportingPrompt",
|
||||||
|
Other: "Włączyć anonimowe raportowanie błędów w celu pomocy w usprawnianiu lazygita (enter/esc)?",
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "removeFile",
|
||||||
|
Other: `usuń jeśli nie śledzony / przełącz jeśli śledzony`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "editFile",
|
||||||
|
Other: `edytuj plik`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "openFile",
|
||||||
|
Other: `otwórz plik`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "ignoreFile",
|
||||||
|
Other: `dodaj do .gitignore`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "refreshFiles",
|
||||||
|
Other: `odśwież pliki`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "resetHard",
|
||||||
|
Other: `zresetuj twardo`,
|
||||||
|
}, &i18n.Message{
|
||||||
|
ID: "mergeIntoCurrentBranch",
|
||||||
|
Other: `scal do obecnej gałęzi`,
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "ConfirmQuit",
|
ID: "ConfirmQuit",
|
||||||
Other: `Na pewno chcesz wyjść z programu?`,
|
Other: `Na pewno chcesz wyjść z programu?`,
|
||||||
|
54
scripts/generate_cheatsheet.go
Normal file
54
scripts/generate_cheatsheet.go
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user