1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00
This commit is contained in:
Jesse Duffield
2022-01-05 12:01:59 +11:00
parent bbb5eee23a
commit 91fe68576c
37 changed files with 229 additions and 256 deletions

View File

@ -12,6 +12,7 @@ type ICmdObj interface {
// using NewFromArgs, the output won't be quite the same as what you would type // using NewFromArgs, the output won't be quite the same as what you would type
// into a terminal e.g. 'sh -c git commit' as opposed to 'sh -c "git commit"' // into a terminal e.g. 'sh -c git commit' as opposed to 'sh -c "git commit"'
ToString() string ToString() string
AddEnvVars(...string) ICmdObj AddEnvVars(...string) ICmdObj
GetEnvVars() []string GetEnvVars() []string
@ -22,9 +23,16 @@ type ICmdObj interface {
// runs the command and runs a callback function on each line of the output. If the callback returns true for the boolean value, we kill the process and return. // runs the command and runs a callback function on each line of the output. If the callback returns true for the boolean value, we kill the process and return.
RunAndProcessLines(onLine func(line string) (bool, error)) error RunAndProcessLines(onLine func(line string) (bool, error)) error
// Marks the command object as readonly, so that when it is run, we don't log it to the user. // Be calling DontLog(), we're saying that once we call Run(), we don't want to
// We only want to log commands to the user which change state in some way. // log the command in the UI (it'll still be logged in the log file). The general rule
// is that if a command doesn't change the git state (e.g. read commands like `git diff`)
// then we don't want to log it. If we are changing something (e.g. `git add .`) then
// we do. The only exception is if we're running a command in the background periodically
// like `git fetch`, which technically does mutate stuff but isn't something we need
// to notify the user about.
DontLog() ICmdObj DontLog() ICmdObj
// This returns false if DontLog() was called
ShouldLog() bool ShouldLog() bool
} }

View File

@ -21,9 +21,8 @@ type ICmdObjBuilder interface {
} }
type CmdObjBuilder struct { type CmdObjBuilder struct {
runner ICmdObjRunner runner ICmdObjRunner
logCmdObj func(ICmdObj) platform *Platform
platform *Platform
} }
// poor man's version of explicitly saying that struct X implements interface Y // poor man's version of explicitly saying that struct X implements interface Y
@ -76,8 +75,27 @@ func (self *CmdObjBuilder) CloneWithNewRunner(decorate func(ICmdObjRunner) ICmdO
decoratedRunner := decorate(self.runner) decoratedRunner := decorate(self.runner)
return &CmdObjBuilder{ return &CmdObjBuilder{
runner: decoratedRunner, runner: decoratedRunner,
logCmdObj: self.logCmdObj, platform: self.platform,
platform: self.platform,
} }
} }
func (self *CmdObjBuilder) Quote(message string) string {
var quote string
if self.platform.OS == "windows" {
quote = `\"`
message = strings.NewReplacer(
`"`, `"'"'"`,
`\"`, `\\"`,
).Replace(message)
} else {
quote = `"`
message = strings.NewReplacer(
`\`, `\\`,
`"`, `\"`,
`$`, `\$`,
"`", "\\`",
).Replace(message)
}
return quote + message + quote
}

View File

@ -22,10 +22,6 @@ type cmdObjRunner struct {
var _ ICmdObjRunner = &cmdObjRunner{} var _ ICmdObjRunner = &cmdObjRunner{}
func (self *cmdObjRunner) Run(cmdObj ICmdObj) error { func (self *cmdObjRunner) Run(cmdObj ICmdObj) error {
if cmdObj.ShouldLog() {
self.logCmdObj(cmdObj)
}
_, err := self.RunWithOutput(cmdObj) _, err := self.RunWithOutput(cmdObj)
return err return err
} }

View File

@ -13,9 +13,8 @@ func NewDummyOSCommand() *OSCommand {
func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder { func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder {
return &CmdObjBuilder{ return &CmdObjBuilder{
runner: runner, runner: runner,
logCmdObj: func(ICmdObj) {}, platform: dummyPlatform,
platform: dummyPlatform,
} }
} }

View File

@ -22,11 +22,11 @@ type OSCommand struct {
Platform *Platform Platform *Platform
Getenv func(string) string Getenv func(string) string
// callback to run before running a command, i.e. for the purposes of logging // callback to run before running a command, i.e. for the purposes of logging.
onRunCommand func(CmdLogEntry) // the string argument is the command string e.g. 'git add .' and the bool is
// whether we're dealing with a command line command or something more general
// something like 'Staging File': allows us to group cmd logs under a single title // like 'Opening PR URL', or something handled by Go's standard library.
CmdLogSpan string logCommandFn func(string, bool)
removeFile func(string) error removeFile func(string) error
@ -42,36 +42,6 @@ type Platform struct {
OpenLinkCommand string OpenLinkCommand string
} }
// TODO: make these fields private
type CmdLogEntry struct {
// e.g. 'git commit -m "haha"'
cmdStr string
// Span is something like 'Staging File'. Multiple commands can be grouped under the same
// span
span string
// sometimes our command is direct like 'git commit', and sometimes it's a
// command to remove a file but through Go's standard library rather than the
// command line
commandLine bool
}
func (e CmdLogEntry) GetCmdStr() string {
return e.cmdStr
}
func (e CmdLogEntry) GetSpan() string {
return e.span
}
func (e CmdLogEntry) GetCommandLine() bool {
return e.commandLine
}
func NewCmdLogEntry(cmdStr string, span string, commandLine bool) CmdLogEntry {
return CmdLogEntry{cmdStr: cmdStr, span: span, commandLine: commandLine}
}
// NewOSCommand os command runner // NewOSCommand os command runner
func NewOSCommand(common *common.Common, platform *Platform) *OSCommand { func NewOSCommand(common *common.Common, platform *Platform) *OSCommand {
c := &OSCommand{ c := &OSCommand{
@ -82,7 +52,7 @@ func NewOSCommand(common *common.Common, platform *Platform) *OSCommand {
} }
runner := &cmdObjRunner{log: common.Log, logCmdObj: c.LogCmdObj} runner := &cmdObjRunner{log: common.Log, logCmdObj: c.LogCmdObj}
c.Cmd = &CmdObjBuilder{runner: runner, logCmdObj: c.LogCmdObj, platform: platform} c.Cmd = &CmdObjBuilder{runner: runner, platform: platform}
return c return c
} }
@ -94,13 +64,13 @@ func (c *OSCommand) LogCmdObj(cmdObj ICmdObj) {
func (c *OSCommand) LogCommand(cmdStr string, commandLine bool) { func (c *OSCommand) LogCommand(cmdStr string, commandLine bool) {
c.Log.WithField("command", cmdStr).Info("RunCommand") c.Log.WithField("command", cmdStr).Info("RunCommand")
if c.onRunCommand != nil { if c.logCommandFn != nil {
c.onRunCommand(NewCmdLogEntry(cmdStr, c.CmdLogSpan, commandLine)) c.logCommandFn(cmdStr, commandLine)
} }
} }
func (c *OSCommand) SetOnRunCommand(f func(CmdLogEntry)) { func (c *OSCommand) SetLogCommandFn(f func(string, bool)) {
c.onRunCommand = f c.logCommandFn = f
} }
// To be used for testing only // To be used for testing only
@ -145,26 +115,6 @@ func (c *OSCommand) Quote(message string) string {
return c.Cmd.Quote(message) return c.Cmd.Quote(message)
} }
func (self *CmdObjBuilder) Quote(message string) string {
var quote string
if self.platform.OS == "windows" {
quote = `\"`
message = strings.NewReplacer(
`"`, `"'"'"`,
`\"`, `\\"`,
).Replace(message)
} else {
quote = `"`
message = strings.NewReplacer(
`\`, `\\`,
`"`, `\"`,
`$`, `\$`,
"`", "\\`",
).Replace(message)
}
return quote + message + quote
}
// AppendLineToFile adds a new line in file // AppendLineToFile adds a new line in file
func (c *OSCommand) AppendLineToFile(filename, line string) error { func (c *OSCommand) AppendLineToFile(filename, line string) error {
c.LogCommand(fmt.Sprintf("Appending '%s' to file '%s'", line, filename), false) c.LogCommand(fmt.Sprintf("Appending '%s' to file '%s'", line, filename), false)
@ -236,15 +186,6 @@ func (c *OSCommand) FileExists(path string) (bool, error) {
return true, nil return true, nil
} }
// GetLazygitPath returns the path of the currently executed file
func (c *OSCommand) GetLazygitPath() string {
ex, err := os.Executable() // get the executable path for git to use
if err != nil {
ex = os.Args[0] // fallback to the first call argument if needed
}
return `"` + filepath.ToSlash(ex) + `"`
}
// PipeCommands runs a heap of commands and pipes their inputs/outputs together like A | B | C // PipeCommands runs a heap of commands and pipes their inputs/outputs together like A | B | C
func (c *OSCommand) PipeCommands(commandStrings ...string) error { func (c *OSCommand) PipeCommands(commandStrings ...string) error {
cmds := make([]*exec.Cmd, len(commandStrings)) cmds := make([]*exec.Cmd, len(commandStrings))
@ -333,3 +274,12 @@ func (c *OSCommand) RemoveFile(path string) error {
func GetTempDir() string { func GetTempDir() string {
return filepath.Join(os.TempDir(), "lazygit") return filepath.Join(os.TempDir(), "lazygit")
} }
// GetLazygitPath returns the path of the currently executed file
func GetLazygitPath() string {
ex, err := os.Executable() // get the executable path for git to use
if err != nil {
ex = os.Args[0] // fallback to the first call argument if needed
}
return `"` + filepath.ToSlash(ex) + `"`
}

View File

@ -59,7 +59,7 @@ func (c *GitCommand) InteractiveRebase(commits []*models.Commit, index int, acti
// we tell git to run lazygit to edit the todo list, and we pass the client // we tell git to run lazygit to edit the todo list, and we pass the client
// lazygit a todo string to write to the todo file // lazygit a todo string to write to the todo file
func (c *GitCommand) PrepareInteractiveRebaseCommand(baseSha string, todo string, overrideEditor bool) (oscommands.ICmdObj, error) { func (c *GitCommand) PrepareInteractiveRebaseCommand(baseSha string, todo string, overrideEditor bool) (oscommands.ICmdObj, error) {
ex := c.OSCommand.GetLazygitPath() ex := oscommands.GetLazygitPath()
debug := "FALSE" debug := "FALSE"
if c.Debug { if c.Debug {
@ -267,8 +267,8 @@ func (c *GitCommand) GenericMergeOrRebaseAction(commandType string, command stri
} }
func (c *GitCommand) runSkipEditorCommand(command string) error { func (c *GitCommand) runSkipEditorCommand(command string) error {
cmdObj := c.OSCommand.Cmd.New(command) cmdObj := c.Cmd.New(command)
lazyGitPath := c.OSCommand.GetLazygitPath() lazyGitPath := oscommands.GetLazygitPath()
return cmdObj. return cmdObj.
AddEnvVars( AddEnvVars(
"LAZYGIT_CLIENT_COMMAND=EXIT_IMMEDIATELY", "LAZYGIT_CLIENT_COMMAND=EXIT_IMMEDIATELY",

View File

@ -7,7 +7,6 @@ import (
"github.com/jesseduffield/lazygit/pkg/commands" "github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/utils" "github.com/jesseduffield/lazygit/pkg/utils"
) )
@ -80,7 +79,7 @@ func (gui *Gui) handleBranchPress() error {
return gui.createErrorPanel(gui.Tr.AlreadyCheckedOutBranch) return gui.createErrorPanel(gui.Tr.AlreadyCheckedOutBranch)
} }
branch := gui.getSelectedBranch() branch := gui.getSelectedBranch()
gui.logSpan(gui.Tr.Spans.CheckoutBranch) gui.logAction(gui.Tr.Actions.CheckoutBranch)
return gui.handleCheckoutRef(branch.Name, handleCheckoutRefOptions{}) return gui.handleCheckoutRef(branch.Name, handleCheckoutRefOptions{})
} }
@ -114,12 +113,11 @@ func (gui *Gui) handleCopyPullRequestURLPress() error {
if err != nil { if err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
gui.logAction(gui.Tr.Actions.CopyPullRequestURL)
if err := gui.GitCommand.OSCommand.CopyToClipboard(url); err != nil { if err := gui.GitCommand.OSCommand.CopyToClipboard(url); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
gui.OnRunCommand(oscommands.NewCmdLogEntry(fmt.Sprintf("Copying to clipboard: '%s'", url), "Copy URL", false))
gui.raiseToast(gui.Tr.PullRequestURLCopiedToClipboard) gui.raiseToast(gui.Tr.PullRequestURLCopiedToClipboard)
return nil return nil
@ -146,7 +144,7 @@ func (gui *Gui) handleForceCheckout() error {
title: title, title: title,
prompt: message, prompt: message,
handleConfirm: func() error { handleConfirm: func() error {
gui.logSpan(gui.Tr.Spans.ForceCheckoutBranch) gui.logAction(gui.Tr.Actions.ForceCheckoutBranch)
if err := gui.GitCommand.Checkout(branch.Name, commands.CheckoutOptions{Force: true}); err != nil { if err := gui.GitCommand.Checkout(branch.Name, commands.CheckoutOptions{Force: true}); err != nil {
_ = gui.surfaceError(err) _ = gui.surfaceError(err)
} }
@ -225,7 +223,7 @@ func (gui *Gui) handleCheckoutByName() error {
title: gui.Tr.BranchName + ":", title: gui.Tr.BranchName + ":",
findSuggestionsFunc: gui.getRefsSuggestionsFunc(), findSuggestionsFunc: gui.getRefsSuggestionsFunc(),
handleConfirm: func(response string) error { handleConfirm: func(response string) error {
gui.logSpan("Checkout branch") gui.logAction("Checkout branch")
return gui.handleCheckoutRef(response, handleCheckoutRefOptions{ return gui.handleCheckoutRef(response, handleCheckoutRefOptions{
onRefNotFound: func(ref string) error { onRefNotFound: func(ref string) error {
return gui.ask(askOpts{ return gui.ask(askOpts{
@ -298,7 +296,7 @@ func (gui *Gui) deleteNamedBranch(selectedBranch *models.Branch, force bool) err
title: title, title: title,
prompt: message, prompt: message,
handleConfirm: func() error { handleConfirm: func() error {
gui.logSpan(gui.Tr.Spans.DeleteBranch) gui.logAction(gui.Tr.Actions.DeleteBranch)
if err := gui.GitCommand.DeleteBranch(selectedBranch.Name, force); err != nil { if err := gui.GitCommand.DeleteBranch(selectedBranch.Name, force); err != nil {
errMessage := err.Error() errMessage := err.Error()
if !force && strings.Contains(errMessage, "git branch -D ") { if !force && strings.Contains(errMessage, "git branch -D ") {
@ -335,7 +333,7 @@ func (gui *Gui) mergeBranchIntoCheckedOutBranch(branchName string) error {
title: gui.Tr.MergingTitle, title: gui.Tr.MergingTitle,
prompt: prompt, prompt: prompt,
handleConfirm: func() error { handleConfirm: func() error {
gui.logSpan(gui.Tr.Spans.Merge) gui.logAction(gui.Tr.Actions.Merge)
err := gui.GitCommand.Merge(branchName, commands.MergeOpts{}) err := gui.GitCommand.Merge(branchName, commands.MergeOpts{})
return gui.handleGenericMergeCommandResult(err) return gui.handleGenericMergeCommandResult(err)
}, },
@ -377,7 +375,7 @@ func (gui *Gui) handleRebaseOntoBranch(selectedBranchName string) error {
title: gui.Tr.RebasingTitle, title: gui.Tr.RebasingTitle,
prompt: prompt, prompt: prompt,
handleConfirm: func() error { handleConfirm: func() error {
gui.logSpan(gui.Tr.Spans.RebaseBranch) gui.logAction(gui.Tr.Actions.RebaseBranch)
err := gui.GitCommand.RebaseBranch(selectedBranchName) err := gui.GitCommand.RebaseBranch(selectedBranchName)
return gui.handleGenericMergeCommandResult(err) return gui.handleGenericMergeCommandResult(err)
}, },
@ -402,7 +400,7 @@ func (gui *Gui) handleFastForward() error {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
span := gui.Tr.Spans.FastForwardBranch action := gui.Tr.Actions.FastForwardBranch
split := strings.Split(upstream, "/") split := strings.Split(upstream, "/")
remoteName := split[0] remoteName := split[0]
@ -419,9 +417,9 @@ func (gui *Gui) handleFastForward() error {
_ = gui.createLoaderPanel(message) _ = gui.createLoaderPanel(message)
if gui.State.Panels.Branches.SelectedLineIdx == 0 { if gui.State.Panels.Branches.SelectedLineIdx == 0 {
_ = gui.pullWithLock(PullFilesOptions{span: span, FastForwardOnly: true}) _ = gui.pullWithLock(PullFilesOptions{action: action, FastForwardOnly: true})
} else { } else {
gui.logSpan(span) gui.logAction(action)
err := gui.GitCommand.FastForward(branch.Name, remoteName, remoteBranchName, gui.promptUserForCredential) err := gui.GitCommand.FastForward(branch.Name, remoteName, remoteBranchName, gui.promptUserForCredential)
gui.handleCredentialsPopup(err) gui.handleCredentialsPopup(err)
_ = gui.refreshSidePanels(refreshOptions{mode: ASYNC, scope: []RefreshableView{BRANCHES}}) _ = gui.refreshSidePanels(refreshOptions{mode: ASYNC, scope: []RefreshableView{BRANCHES}})
@ -450,7 +448,7 @@ func (gui *Gui) handleRenameBranch() error {
title: gui.Tr.NewBranchNamePrompt + " " + branch.Name + ":", title: gui.Tr.NewBranchNamePrompt + " " + branch.Name + ":",
initialContent: branch.Name, initialContent: branch.Name,
handleConfirm: func(newBranchName string) error { handleConfirm: func(newBranchName string) error {
gui.logSpan(gui.Tr.Spans.RenameBranch) gui.logAction(gui.Tr.Actions.RenameBranch)
if err := gui.GitCommand.RenameBranch(branch.Name, newBranchName); err != nil { if err := gui.GitCommand.RenameBranch(branch.Name, newBranchName); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -519,7 +517,7 @@ func (gui *Gui) handleNewBranchOffCurrentItem() error {
title: message, title: message,
initialContent: prefilledName, initialContent: prefilledName,
handleConfirm: func(response string) error { handleConfirm: func(response string) error {
gui.logSpan(gui.Tr.Spans.CreateBranch) gui.logAction(gui.Tr.Actions.CreateBranch)
if err := gui.GitCommand.NewBranch(sanitizedBranchName(response), item.ID()); err != nil { if err := gui.GitCommand.NewBranch(sanitizedBranchName(response), item.ID()); err != nil {
return err return err
} }

View File

@ -148,7 +148,7 @@ func (gui *Gui) HandlePasteCommits() error {
prompt: gui.Tr.SureCherryPick, prompt: gui.Tr.SureCherryPick,
handleConfirm: func() error { handleConfirm: func() error {
return gui.WithWaitingStatus(gui.Tr.CherryPickingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.CherryPickingStatus, func() error {
gui.logSpan(gui.Tr.Spans.CherryPick) gui.logAction(gui.Tr.Actions.CherryPick)
err := gui.GitCommand.CherryPickCommits(gui.State.Modes.CherryPicking.CherryPickedCommits) err := gui.GitCommand.CherryPickCommits(gui.State.Modes.CherryPicking.CherryPickedCommits)
return gui.handleGenericMergeCommandResult(err) return gui.handleGenericMergeCommandResult(err)
}) })

View File

@ -6,38 +6,48 @@ import (
"strings" "strings"
"time" "time"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/constants" "github.com/jesseduffield/lazygit/pkg/constants"
"github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/gui/style"
"github.com/jesseduffield/lazygit/pkg/theme" "github.com/jesseduffield/lazygit/pkg/theme"
) )
func (gui *Gui) GetOnRunCommand() func(entry oscommands.CmdLogEntry) { // our UI command log looks like this:
return func(entry oscommands.CmdLogEntry) { // Stage File
if gui.Views.Extras == nil { // git add -- 'filename'
return // Unstage File
} // git reset HEAD 'filename'
//
gui.Views.Extras.Autoscroll = true // The 'Stage File' and 'Unstage File' lines are actions i.e they group up a set
// of command logs (typically there's only one command under an action but there may be more).
textStyle := theme.DefaultTextColor // So we call logAction to log the 'Stage File' part and then we call logCommand to log the command itself.
if !entry.GetCommandLine() { // We pass logCommand to our OSCommand struct so that it can handle logging commands
textStyle = style.FgMagenta // for us.
} func (gui *Gui) logAction(action string) {
gui.CmdLog = append(gui.CmdLog, entry.GetCmdStr())
indentedCmdStr := " " + strings.Replace(entry.GetCmdStr(), "\n", "\n ", -1)
fmt.Fprint(gui.Views.Extras, "\n"+textStyle.Sprint(indentedCmdStr))
}
}
func (gui *Gui) logSpan(span string) {
if gui.Views.Extras == nil { if gui.Views.Extras == nil {
return return
} }
gui.Views.Extras.Autoscroll = true gui.Views.Extras.Autoscroll = true
fmt.Fprint(gui.Views.Extras, "\n"+style.FgYellow.Sprint(span)) fmt.Fprint(gui.Views.Extras, "\n"+style.FgYellow.Sprint(action))
}
func (gui *Gui) logCommand(cmdStr string, commandLine bool) {
if gui.Views.Extras == nil {
return
}
gui.Views.Extras.Autoscroll = true
textStyle := theme.DefaultTextColor
if !commandLine {
// if we're not dealing with a direct command that could be run on the command line,
// we style it differently to communicate that
textStyle = style.FgMagenta
}
gui.CmdLog = append(gui.CmdLog, cmdStr)
indentedCmdStr := " " + strings.Replace(cmdStr, "\n", "\n ", -1)
fmt.Fprint(gui.Views.Extras, "\n"+textStyle.Sprint(indentedCmdStr))
} }
func (gui *Gui) printCommandLogHeader() { func (gui *Gui) printCommandLogHeader() {

View File

@ -63,7 +63,7 @@ func (gui *Gui) handleCheckoutCommitFile() error {
return nil return nil
} }
gui.logSpan(gui.Tr.Spans.CheckoutFile) gui.logAction(gui.Tr.Actions.CheckoutFile)
if err := gui.GitCommand.CheckoutFile(gui.State.CommitFileManager.GetParent(), node.GetPath()); err != nil { if err := gui.GitCommand.CheckoutFile(gui.State.CommitFileManager.GetParent(), node.GetPath()); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -83,7 +83,7 @@ func (gui *Gui) handleDiscardOldFileChange() error {
prompt: gui.Tr.DiscardFileChangesPrompt, prompt: gui.Tr.DiscardFileChangesPrompt,
handleConfirm: func() error { handleConfirm: func() error {
return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error {
gui.logSpan(gui.Tr.Spans.DiscardOldFileChange) gui.logAction(gui.Tr.Actions.DiscardOldFileChange)
if err := gui.GitCommand.DiscardOldFileChanges(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, fileName); err != nil { if err := gui.GitCommand.DiscardOldFileChanges(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, fileName); err != nil {
if err := gui.handleGenericMergeCommandResult(err); err != nil { if err := gui.handleGenericMergeCommandResult(err); err != nil {
return err return err

View File

@ -5,7 +5,6 @@ import (
"strings" "strings"
"github.com/jesseduffield/gocui" "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/utils" "github.com/jesseduffield/lazygit/pkg/utils"
) )
@ -25,7 +24,7 @@ func (gui *Gui) handleCommitConfirm() error {
} }
cmdObj := gui.GitCommand.CommitCmdObj(message, strings.Join(flags, " ")) cmdObj := gui.GitCommand.CommitCmdObj(message, strings.Join(flags, " "))
gui.OnRunCommand(oscommands.NewCmdLogEntry(cmdObj.ToString(), gui.Tr.Spans.Commit, true)) gui.logAction(gui.Tr.Actions.Commit)
_ = gui.returnFromContext() _ = gui.returnFromContext()
return gui.withGpgHandling(cmdObj, gui.Tr.CommittingStatus, func() error { return gui.withGpgHandling(cmdObj, gui.Tr.CommittingStatus, func() error {

View File

@ -6,7 +6,6 @@ import (
"github.com/jesseduffield/lazygit/pkg/commands/loaders" "github.com/jesseduffield/lazygit/pkg/commands/loaders"
"github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/utils" "github.com/jesseduffield/lazygit/pkg/utils"
) )
@ -173,7 +172,7 @@ func (gui *Gui) handleCommitSquashDown() error {
prompt: gui.Tr.SureSquashThisCommit, prompt: gui.Tr.SureSquashThisCommit,
handleConfirm: func() error { handleConfirm: func() error {
return gui.WithWaitingStatus(gui.Tr.SquashingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.SquashingStatus, func() error {
gui.logSpan(gui.Tr.Spans.SquashCommitDown) gui.logAction(gui.Tr.Actions.SquashCommitDown)
err := gui.GitCommand.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "squash") err := gui.GitCommand.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "squash")
return gui.handleGenericMergeCommandResult(err) return gui.handleGenericMergeCommandResult(err)
}) })
@ -203,7 +202,7 @@ func (gui *Gui) handleCommitFixup() error {
prompt: gui.Tr.SureFixupThisCommit, prompt: gui.Tr.SureFixupThisCommit,
handleConfirm: func() error { handleConfirm: func() error {
return gui.WithWaitingStatus(gui.Tr.FixingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.FixingStatus, func() error {
gui.logSpan(gui.Tr.Spans.FixupCommit) gui.logAction(gui.Tr.Actions.FixupCommit)
err := gui.GitCommand.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "fixup") err := gui.GitCommand.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "fixup")
return gui.handleGenericMergeCommandResult(err) return gui.handleGenericMergeCommandResult(err)
}) })
@ -242,7 +241,7 @@ func (gui *Gui) handleRenameCommit() error {
title: gui.Tr.LcRenameCommit, title: gui.Tr.LcRenameCommit,
initialContent: message, initialContent: message,
handleConfirm: func(response string) error { handleConfirm: func(response string) error {
gui.logSpan(gui.Tr.Spans.RewordCommit) gui.logAction(gui.Tr.Actions.RewordCommit)
if err := gui.GitCommand.RenameCommit(response); err != nil { if err := gui.GitCommand.RenameCommit(response); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -265,7 +264,7 @@ func (gui *Gui) handleRenameCommitEditor() error {
return nil return nil
} }
gui.logSpan(gui.Tr.Spans.RewordCommit) gui.logAction(gui.Tr.Actions.RewordCommit)
subProcess, err := gui.GitCommand.RewordCommit(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx) subProcess, err := gui.GitCommand.RewordCommit(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx)
if err != nil { if err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
@ -294,11 +293,11 @@ func (gui *Gui) handleMidRebaseCommand(action string) (bool, error) {
return true, gui.createErrorPanel(gui.Tr.LcRewordNotSupported) return true, gui.createErrorPanel(gui.Tr.LcRewordNotSupported)
} }
gui.OnRunCommand(oscommands.NewCmdLogEntry( gui.logAction("Update rebase TODO")
gui.logCommand(
fmt.Sprintf("Updating rebase action of commit %s to '%s'", selectedCommit.ShortSha(), action), fmt.Sprintf("Updating rebase action of commit %s to '%s'", selectedCommit.ShortSha(), action),
"Update rebase TODO",
false, false,
)) )
if err := gui.GitCommand.EditRebaseTodo(gui.State.Panels.Commits.SelectedLineIdx, action); err != nil { if err := gui.GitCommand.EditRebaseTodo(gui.State.Panels.Commits.SelectedLineIdx, action); err != nil {
return false, gui.surfaceError(err) return false, gui.surfaceError(err)
@ -325,7 +324,7 @@ func (gui *Gui) handleCommitDelete() error {
prompt: gui.Tr.DeleteCommitPrompt, prompt: gui.Tr.DeleteCommitPrompt,
handleConfirm: func() error { handleConfirm: func() error {
return gui.WithWaitingStatus(gui.Tr.DeletingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.DeletingStatus, func() error {
gui.logSpan(gui.Tr.Spans.DropCommit) gui.logAction(gui.Tr.Actions.DropCommit)
err := gui.GitCommand.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "drop") err := gui.GitCommand.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "drop")
return gui.handleGenericMergeCommandResult(err) return gui.handleGenericMergeCommandResult(err)
}) })
@ -338,8 +337,6 @@ func (gui *Gui) handleCommitMoveDown() error {
return err return err
} }
span := gui.Tr.Spans.MoveCommitDown
index := gui.State.Panels.Commits.SelectedLineIdx index := gui.State.Panels.Commits.SelectedLineIdx
selectedCommit := gui.State.Commits[index] selectedCommit := gui.State.Commits[index]
if selectedCommit.Status == "rebasing" { if selectedCommit.Status == "rebasing" {
@ -349,11 +346,8 @@ func (gui *Gui) handleCommitMoveDown() error {
// logging directly here because MoveTodoDown doesn't have enough information // logging directly here because MoveTodoDown doesn't have enough information
// to provide a useful log // to provide a useful log
gui.OnRunCommand(oscommands.NewCmdLogEntry( gui.logAction(gui.Tr.Actions.MoveCommitDown)
fmt.Sprintf("Moving commit %s down", selectedCommit.ShortSha()), gui.logCommand(fmt.Sprintf("Moving commit %s down", selectedCommit.ShortSha()), false)
span,
false,
))
if err := gui.GitCommand.MoveTodoDown(index); err != nil { if err := gui.GitCommand.MoveTodoDown(index); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
@ -363,7 +357,7 @@ func (gui *Gui) handleCommitMoveDown() error {
} }
return gui.WithWaitingStatus(gui.Tr.MovingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.MovingStatus, func() error {
gui.logSpan(span) gui.logAction(gui.Tr.Actions.MoveCommitDown)
err := gui.GitCommand.MoveCommitDown(gui.State.Commits, index) err := gui.GitCommand.MoveCommitDown(gui.State.Commits, index)
if err == nil { if err == nil {
gui.State.Panels.Commits.SelectedLineIdx++ gui.State.Panels.Commits.SelectedLineIdx++
@ -382,17 +376,15 @@ func (gui *Gui) handleCommitMoveUp() error {
return nil return nil
} }
span := gui.Tr.Spans.MoveCommitUp
selectedCommit := gui.State.Commits[index] selectedCommit := gui.State.Commits[index]
if selectedCommit.Status == "rebasing" { if selectedCommit.Status == "rebasing" {
// logging directly here because MoveTodoDown doesn't have enough information // logging directly here because MoveTodoDown doesn't have enough information
// to provide a useful log // to provide a useful log
gui.OnRunCommand(oscommands.NewCmdLogEntry( gui.logAction(gui.Tr.Actions.MoveCommitUp)
gui.logCommand(
fmt.Sprintf("Moving commit %s up", selectedCommit.ShortSha()), fmt.Sprintf("Moving commit %s up", selectedCommit.ShortSha()),
span,
false, false,
)) )
if err := gui.GitCommand.MoveTodoDown(index - 1); err != nil { if err := gui.GitCommand.MoveTodoDown(index - 1); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
@ -402,7 +394,7 @@ func (gui *Gui) handleCommitMoveUp() error {
} }
return gui.WithWaitingStatus(gui.Tr.MovingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.MovingStatus, func() error {
gui.logSpan(span) gui.logAction(gui.Tr.Actions.MoveCommitUp)
err := gui.GitCommand.MoveCommitDown(gui.State.Commits, index-1) err := gui.GitCommand.MoveCommitDown(gui.State.Commits, index-1)
if err == nil { if err == nil {
gui.State.Panels.Commits.SelectedLineIdx-- gui.State.Panels.Commits.SelectedLineIdx--
@ -425,7 +417,7 @@ func (gui *Gui) handleCommitEdit() error {
} }
return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error {
gui.logSpan(gui.Tr.Spans.EditCommit) gui.logAction(gui.Tr.Actions.EditCommit)
err = gui.GitCommand.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "edit") err = gui.GitCommand.InteractiveRebase(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, "edit")
return gui.handleGenericMergeCommandResult(err) return gui.handleGenericMergeCommandResult(err)
}) })
@ -441,7 +433,7 @@ func (gui *Gui) handleCommitAmendTo() error {
prompt: gui.Tr.AmendCommitPrompt, prompt: gui.Tr.AmendCommitPrompt,
handleConfirm: func() error { handleConfirm: func() error {
return gui.WithWaitingStatus(gui.Tr.AmendingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.AmendingStatus, func() error {
gui.logSpan(gui.Tr.Spans.AmendCommit) gui.logAction(gui.Tr.Actions.AmendCommit)
err := gui.GitCommand.AmendTo(gui.State.Commits[gui.State.Panels.Commits.SelectedLineIdx].Sha) err := gui.GitCommand.AmendTo(gui.State.Commits[gui.State.Panels.Commits.SelectedLineIdx].Sha)
return gui.handleGenericMergeCommandResult(err) return gui.handleGenericMergeCommandResult(err)
}) })
@ -477,7 +469,7 @@ func (gui *Gui) handleCommitRevert() error {
if commit.IsMerge() { if commit.IsMerge() {
return gui.createRevertMergeCommitMenu(commit) return gui.createRevertMergeCommitMenu(commit)
} else { } else {
gui.logSpan(gui.Tr.Spans.RevertCommit) gui.logAction(gui.Tr.Actions.RevertCommit)
if err := gui.GitCommand.Revert(commit.Sha); err != nil { if err := gui.GitCommand.Revert(commit.Sha); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -498,7 +490,7 @@ func (gui *Gui) createRevertMergeCommitMenu(commit *models.Commit) error {
displayString: fmt.Sprintf("%s: %s", utils.SafeTruncate(parentSha, 8), message), displayString: fmt.Sprintf("%s: %s", utils.SafeTruncate(parentSha, 8), message),
onPress: func() error { onPress: func() error {
parentNumber := i + 1 parentNumber := i + 1
gui.logSpan(gui.Tr.Spans.RevertCommit) gui.logAction(gui.Tr.Actions.RevertCommit)
if err := gui.GitCommand.RevertMerge(commit.Sha, parentNumber); err != nil { if err := gui.GitCommand.RevertMerge(commit.Sha, parentNumber); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -545,7 +537,7 @@ func (gui *Gui) handleCreateFixupCommit() error {
title: gui.Tr.CreateFixupCommit, title: gui.Tr.CreateFixupCommit,
prompt: prompt, prompt: prompt,
handleConfirm: func() error { handleConfirm: func() error {
gui.logSpan(gui.Tr.Spans.CreateFixupCommit) gui.logAction(gui.Tr.Actions.CreateFixupCommit)
if err := gui.GitCommand.CreateFixupCommit(commit.Sha); err != nil { if err := gui.GitCommand.CreateFixupCommit(commit.Sha); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -577,7 +569,7 @@ func (gui *Gui) handleSquashAllAboveFixupCommits() error {
prompt: prompt, prompt: prompt,
handleConfirm: func() error { handleConfirm: func() error {
return gui.WithWaitingStatus(gui.Tr.SquashingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.SquashingStatus, func() error {
gui.logSpan(gui.Tr.Spans.SquashAllAboveFixupCommits) gui.logAction(gui.Tr.Actions.SquashAllAboveFixupCommits)
err := gui.GitCommand.SquashAllAboveFixupCommits(commit.Sha) err := gui.GitCommand.SquashAllAboveFixupCommits(commit.Sha)
return gui.handleGenericMergeCommandResult(err) return gui.handleGenericMergeCommandResult(err)
}) })
@ -625,7 +617,7 @@ func (gui *Gui) handleCreateAnnotatedTag(commitSha string) error {
return gui.prompt(promptOpts{ return gui.prompt(promptOpts{
title: gui.Tr.TagMessageTitle, title: gui.Tr.TagMessageTitle,
handleConfirm: func(msg string) error { handleConfirm: func(msg string) error {
gui.logSpan(gui.Tr.Spans.CreateAnnotatedTag) gui.logAction(gui.Tr.Actions.CreateAnnotatedTag)
if err := gui.GitCommand.CreateAnnotatedTag(tagName, commitSha, msg); err != nil { if err := gui.GitCommand.CreateAnnotatedTag(tagName, commitSha, msg); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -640,7 +632,7 @@ func (gui *Gui) handleCreateLightweightTag(commitSha string) error {
return gui.prompt(promptOpts{ return gui.prompt(promptOpts{
title: gui.Tr.TagNameTitle, title: gui.Tr.TagNameTitle,
handleConfirm: func(tagName string) error { handleConfirm: func(tagName string) error {
gui.logSpan(gui.Tr.Spans.CreateLightweightTag) gui.logAction(gui.Tr.Actions.CreateLightweightTag)
if err := gui.GitCommand.CreateLightweightTag(tagName, commitSha); err != nil { if err := gui.GitCommand.CreateLightweightTag(tagName, commitSha); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -659,7 +651,7 @@ func (gui *Gui) handleCheckoutCommit() error {
title: gui.Tr.LcCheckoutCommit, title: gui.Tr.LcCheckoutCommit,
prompt: gui.Tr.SureCheckoutThisCommit, prompt: gui.Tr.SureCheckoutThisCommit,
handleConfirm: func() error { handleConfirm: func() error {
gui.logSpan(gui.Tr.Spans.CheckoutCommit) gui.logAction(gui.Tr.Actions.CheckoutCommit)
return gui.handleCheckoutRef(commit.Sha, handleCheckoutRefOptions{}) return gui.handleCheckoutRef(commit.Sha, handleCheckoutRefOptions{})
}, },
}) })
@ -715,7 +707,7 @@ func (gui *Gui) handleCopySelectedCommitMessageToClipboard() error {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
gui.logSpan(gui.Tr.Spans.CopyCommitMessageToClipboard) gui.logAction(gui.Tr.Actions.CopyCommitMessageToClipboard)
if err := gui.OSCommand.CopyToClipboard(message); err != nil { if err := gui.OSCommand.CopyToClipboard(message); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -826,7 +818,8 @@ func (gui *Gui) handleOpenCommitInBrowser() error {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
gui.OnRunCommand(oscommands.NewCmdLogEntry(fmt.Sprintf(gui.Tr.OpeningCommitInBrowser, url), gui.Tr.CreatePullRequest, false)) gui.logAction(gui.Tr.CreatePullRequest)
gui.logCommand(fmt.Sprintf(gui.Tr.OpeningCommitInBrowser, url), false)
return nil return nil
} }

View File

@ -252,7 +252,7 @@ func (gui *Gui) handleCustomCommandKeybinding(customCommand config.CustomCommand
loadingText = gui.Tr.LcRunningCustomCommandStatus loadingText = gui.Tr.LcRunningCustomCommandStatus
} }
return gui.WithWaitingStatus(loadingText, func() error { return gui.WithWaitingStatus(loadingText, func() error {
gui.logSpan(gui.Tr.Spans.CustomCommand) gui.logAction(gui.Tr.Actions.CustomCommand)
err := gui.OSCommand.Cmd.NewShell(cmdStr).Run() err := gui.OSCommand.Cmd.NewShell(cmdStr).Run()
if err != nil { if err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)

View File

@ -12,7 +12,7 @@ func (gui *Gui) handleCreateDiscardMenu() error {
{ {
displayString: gui.Tr.LcDiscardAllChanges, displayString: gui.Tr.LcDiscardAllChanges,
onPress: func() error { onPress: func() error {
gui.logSpan(gui.Tr.Spans.DiscardAllChangesInDirectory) gui.logAction(gui.Tr.Actions.DiscardAllChangesInDirectory)
if err := gui.GitCommand.DiscardAllDirChanges(node); err != nil { if err := gui.GitCommand.DiscardAllDirChanges(node); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -25,7 +25,7 @@ func (gui *Gui) handleCreateDiscardMenu() error {
menuItems = append(menuItems, &menuItem{ menuItems = append(menuItems, &menuItem{
displayString: gui.Tr.LcDiscardUnstagedChanges, displayString: gui.Tr.LcDiscardUnstagedChanges,
onPress: func() error { onPress: func() error {
gui.logSpan(gui.Tr.Spans.DiscardUnstagedChangesInDirectory) gui.logAction(gui.Tr.Actions.DiscardUnstagedChangesInDirectory)
if err := gui.GitCommand.DiscardUnstagedDirChanges(node); err != nil { if err := gui.GitCommand.DiscardUnstagedDirChanges(node); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -54,7 +54,7 @@ func (gui *Gui) handleCreateDiscardMenu() error {
{ {
displayString: gui.Tr.LcDiscardAllChanges, displayString: gui.Tr.LcDiscardAllChanges,
onPress: func() error { onPress: func() error {
gui.logSpan(gui.Tr.Spans.DiscardAllChangesInFile) gui.logAction(gui.Tr.Actions.DiscardAllChangesInFile)
if err := gui.GitCommand.DiscardAllFileChanges(file); err != nil { if err := gui.GitCommand.DiscardAllFileChanges(file); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -67,7 +67,7 @@ func (gui *Gui) handleCreateDiscardMenu() error {
menuItems = append(menuItems, &menuItem{ menuItems = append(menuItems, &menuItem{
displayString: gui.Tr.LcDiscardUnstagedChanges, displayString: gui.Tr.LcDiscardUnstagedChanges,
onPress: func() error { onPress: func() error {
gui.logSpan(gui.Tr.Spans.DiscardAllUnstagedChangesInFile) gui.logAction(gui.Tr.Actions.DiscardAllUnstagedChangesInFile)
if err := gui.GitCommand.DiscardUnstagedFileChanges(file); err != nil { if err := gui.GitCommand.DiscardUnstagedFileChanges(file); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }

View File

@ -9,7 +9,6 @@ import (
"github.com/jesseduffield/lazygit/pkg/commands" "github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/commands/loaders" "github.com/jesseduffield/lazygit/pkg/commands/loaders"
"github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/config" "github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/gui/filetree" "github.com/jesseduffield/lazygit/pkg/gui/filetree"
"github.com/jesseduffield/lazygit/pkg/utils" "github.com/jesseduffield/lazygit/pkg/utils"
@ -207,12 +206,12 @@ func (gui *Gui) handleFilePress() error {
} }
if file.HasUnstagedChanges { if file.HasUnstagedChanges {
gui.logSpan(gui.Tr.Spans.StageFile) gui.logAction(gui.Tr.Actions.StageFile)
if err := gui.GitCommand.StageFile(file.Name); err != nil { if err := gui.GitCommand.StageFile(file.Name); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
} else { } else {
gui.logSpan(gui.Tr.Spans.UnstageFile) gui.logAction(gui.Tr.Actions.UnstageFile)
if err := gui.GitCommand.UnStageFile(file.Names(), file.Tracked); err != nil { if err := gui.GitCommand.UnStageFile(file.Names(), file.Tracked); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -225,13 +224,13 @@ func (gui *Gui) handleFilePress() error {
} }
if node.GetHasUnstagedChanges() { if node.GetHasUnstagedChanges() {
gui.logSpan(gui.Tr.Spans.StageFile) gui.logAction(gui.Tr.Actions.StageFile)
if err := gui.GitCommand.StageFile(node.Path); err != nil { if err := gui.GitCommand.StageFile(node.Path); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
} else { } else {
// pretty sure it doesn't matter that we're always passing true here // pretty sure it doesn't matter that we're always passing true here
gui.logSpan(gui.Tr.Spans.UnstageFile) gui.logAction(gui.Tr.Actions.UnstageFile)
if err := gui.GitCommand.UnStageFile([]string{node.Path}, true); err != nil { if err := gui.GitCommand.UnStageFile([]string{node.Path}, true); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -262,10 +261,10 @@ func (gui *Gui) onFocusFile() error {
func (gui *Gui) handleStageAll() error { func (gui *Gui) handleStageAll() error {
var err error var err error
if gui.allFilesStaged() { if gui.allFilesStaged() {
gui.logSpan(gui.Tr.Spans.UnstageAllFiles) gui.logAction(gui.Tr.Actions.UnstageAllFiles)
err = gui.GitCommand.UnstageAll() err = gui.GitCommand.UnstageAll()
} else { } else {
gui.logSpan(gui.Tr.Spans.StageAllFiles) gui.logAction(gui.Tr.Actions.StageAllFiles)
err = gui.GitCommand.StageAll() err = gui.GitCommand.StageAll()
} }
if err != nil { if err != nil {
@ -289,7 +288,7 @@ func (gui *Gui) handleIgnoreFile() error {
return gui.createErrorPanel("Cannot ignore .gitignore") return gui.createErrorPanel("Cannot ignore .gitignore")
} }
gui.logSpan(gui.Tr.Spans.IgnoreFile) gui.logAction(gui.Tr.Actions.IgnoreFile)
unstageFiles := func() error { unstageFiles := func() error {
return node.ForEachFile(func(file *models.File) error { return node.ForEachFile(func(file *models.File) error {
@ -362,7 +361,7 @@ func (gui *Gui) commitPrefixConfigForRepo() *config.CommitPrefixConfig {
func (gui *Gui) prepareFilesForCommit() error { func (gui *Gui) prepareFilesForCommit() error {
noStagedFiles := len(gui.stagedFiles()) == 0 noStagedFiles := len(gui.stagedFiles()) == 0
if noStagedFiles && gui.UserConfig.Gui.SkipNoStagedFilesWarning { if noStagedFiles && gui.UserConfig.Gui.SkipNoStagedFilesWarning {
gui.logSpan(gui.Tr.Spans.StageAllFiles) gui.logAction(gui.Tr.Actions.StageAllFiles)
err := gui.GitCommand.StageAll() err := gui.GitCommand.StageAll()
if err != nil { if err != nil {
return err return err
@ -417,7 +416,7 @@ func (gui *Gui) promptToStageAllAndRetry(retry func() error) error {
title: gui.Tr.NoFilesStagedTitle, title: gui.Tr.NoFilesStagedTitle,
prompt: gui.Tr.NoFilesStagedPrompt, prompt: gui.Tr.NoFilesStagedPrompt,
handleConfirm: func() error { handleConfirm: func() error {
gui.logSpan(gui.Tr.Spans.StageAllFiles) gui.logAction(gui.Tr.Actions.StageAllFiles)
if err := gui.GitCommand.StageAll(); err != nil { if err := gui.GitCommand.StageAll(); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -448,7 +447,7 @@ func (gui *Gui) handleAmendCommitPress() error {
prompt: gui.Tr.SureToAmend, prompt: gui.Tr.SureToAmend,
handleConfirm: func() error { handleConfirm: func() error {
cmdObj := gui.GitCommand.AmendHeadCmdObj() cmdObj := gui.GitCommand.AmendHeadCmdObj()
gui.OnRunCommand(oscommands.NewCmdLogEntry(cmdObj.ToString(), gui.Tr.Spans.AmendCommit, true)) gui.logAction(gui.Tr.Actions.AmendCommit)
return gui.withGpgHandling(cmdObj, gui.Tr.AmendingStatus, nil) return gui.withGpgHandling(cmdObj, gui.Tr.AmendingStatus, nil)
}, },
}) })
@ -473,7 +472,7 @@ func (gui *Gui) handleCommitEditorPress() error {
cmdStr := "git " + strings.Join(args, " ") cmdStr := "git " + strings.Join(args, " ")
gui.logSpan(gui.Tr.Spans.Commit) gui.logAction(gui.Tr.Actions.Commit)
return gui.runSubprocessWithSuspenseAndRefresh( return gui.runSubprocessWithSuspenseAndRefresh(
gui.GitCommand.Cmd.New(cmdStr), gui.GitCommand.Cmd.New(cmdStr),
) )
@ -520,7 +519,7 @@ func (gui *Gui) editFileAtLine(filename string, lineNumber int) error {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
gui.logSpan(gui.Tr.Spans.EditFile) gui.logAction(gui.Tr.Actions.EditFile)
return gui.runSubprocessWithSuspenseAndRefresh( return gui.runSubprocessWithSuspenseAndRefresh(
gui.OSCommand.Cmd.NewShell(cmdStr), gui.OSCommand.Cmd.NewShell(cmdStr),
) )
@ -652,7 +651,7 @@ func (gui *Gui) handlePullFiles() error {
return nil return nil
} }
span := gui.Tr.Spans.Pull action := gui.Tr.Actions.Pull
currentBranch := gui.currentBranch() currentBranch := gui.currentBranch()
if currentBranch == nil { if currentBranch == nil {
@ -669,7 +668,7 @@ func (gui *Gui) handlePullFiles() error {
} }
for branchName, branch := range conf.Branches { for branchName, branch := range conf.Branches {
if branchName == currentBranch.Name { if branchName == currentBranch.Name {
return gui.pullFiles(PullFilesOptions{RemoteName: branch.Remote, BranchName: branch.Name, span: span}) return gui.pullFiles(PullFilesOptions{RemoteName: branch.Remote, BranchName: branch.Name, action: action})
} }
} }
@ -687,19 +686,19 @@ func (gui *Gui) handlePullFiles() error {
} }
return gui.createErrorPanel(errorMessage) return gui.createErrorPanel(errorMessage)
} }
return gui.pullFiles(PullFilesOptions{span: span}) return gui.pullFiles(PullFilesOptions{action: action})
}, },
}) })
} }
return gui.pullFiles(PullFilesOptions{span: span}) return gui.pullFiles(PullFilesOptions{action: action})
} }
type PullFilesOptions struct { type PullFilesOptions struct {
RemoteName string RemoteName string
BranchName string BranchName string
FastForwardOnly bool FastForwardOnly bool
span string action string
} }
func (gui *Gui) pullFiles(opts PullFilesOptions) error { func (gui *Gui) pullFiles(opts PullFilesOptions) error {
@ -717,7 +716,7 @@ func (gui *Gui) pullWithLock(opts PullFilesOptions) error {
gui.Mutexes.FetchMutex.Lock() gui.Mutexes.FetchMutex.Lock()
defer gui.Mutexes.FetchMutex.Unlock() defer gui.Mutexes.FetchMutex.Unlock()
gui.logSpan(opts.span) gui.logAction(opts.action)
err := gui.GitCommand.Pull( err := gui.GitCommand.Pull(
commands.PullOptions{ commands.PullOptions{
@ -745,7 +744,7 @@ func (gui *Gui) push(opts pushOpts) error {
return err return err
} }
go utils.Safe(func() { go utils.Safe(func() {
gui.logSpan(gui.Tr.Spans.Push) gui.logAction(gui.Tr.Actions.Push)
err := gui.GitCommand.Push(commands.PushOpts{ err := gui.GitCommand.Push(commands.PushOpts{
Force: opts.force, Force: opts.force,
UpstreamRemote: opts.upstreamRemote, UpstreamRemote: opts.upstreamRemote,
@ -902,7 +901,7 @@ func (gui *Gui) handleSwitchToMerge() error {
} }
func (gui *Gui) openFile(filename string) error { func (gui *Gui) openFile(filename string) error {
gui.logSpan(gui.Tr.Spans.OpenFile) gui.logAction(gui.Tr.Actions.OpenFile)
if err := gui.OSCommand.OpenFile(filename); err != nil { if err := gui.OSCommand.OpenFile(filename); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -935,7 +934,7 @@ func (gui *Gui) handleCustomCommand() error {
gui.Log.Error(err) gui.Log.Error(err)
} }
gui.OnRunCommand(oscommands.NewCmdLogEntry(command, gui.Tr.Spans.CustomCommand, true)) gui.logAction(gui.Tr.Actions.CustomCommand)
return gui.runSubprocessWithSuspenseAndRefresh( return gui.runSubprocessWithSuspenseAndRefresh(
gui.OSCommand.Cmd.NewShell(command), gui.OSCommand.Cmd.NewShell(command),
) )
@ -948,14 +947,14 @@ func (gui *Gui) handleCreateStashMenu() error {
{ {
displayString: gui.Tr.LcStashAllChanges, displayString: gui.Tr.LcStashAllChanges,
onPress: func() error { onPress: func() error {
gui.logSpan(gui.Tr.Spans.StashAllChanges) gui.logAction(gui.Tr.Actions.StashAllChanges)
return gui.handleStashSave(gui.GitCommand.StashSave) return gui.handleStashSave(gui.GitCommand.StashSave)
}, },
}, },
{ {
displayString: gui.Tr.LcStashStagedChanges, displayString: gui.Tr.LcStashStagedChanges,
onPress: func() error { onPress: func() error {
gui.logSpan(gui.Tr.Spans.StashStagedChanges) gui.logAction(gui.Tr.Actions.StashStagedChanges)
return gui.handleStashSave(gui.GitCommand.StashSaveStagedChanges) return gui.handleStashSave(gui.GitCommand.StashSaveStagedChanges)
}, },
}, },
@ -1019,6 +1018,7 @@ func (gui *Gui) handleOpenMergeTool() error {
title: gui.Tr.MergeToolTitle, title: gui.Tr.MergeToolTitle,
prompt: gui.Tr.MergeToolPrompt, prompt: gui.Tr.MergeToolPrompt,
handleConfirm: func() error { handleConfirm: func() error {
gui.logAction(gui.Tr.Actions.OpenMergeTool)
return gui.runSubprocessWithSuspenseAndRefresh( return gui.runSubprocessWithSuspenseAndRefresh(
gui.GitCommand.OpenMergeToolCmdObj(), gui.GitCommand.OpenMergeToolCmdObj(),
) )

View File

@ -31,7 +31,7 @@ func (gui *Gui) gitFlowFinishBranch(gitFlowConfig string, branchName string) err
return gui.createErrorPanel(gui.Tr.NotAGitFlowBranch) return gui.createErrorPanel(gui.Tr.NotAGitFlowBranch)
} }
gui.logSpan(gui.Tr.Spans.GitFlowFinish) gui.logAction(gui.Tr.Actions.GitFlowFinish)
return gui.runSubprocessWithSuspenseAndRefresh( return gui.runSubprocessWithSuspenseAndRefresh(
gui.GitCommand.Cmd.New("git flow " + branchType + " finish " + suffix), gui.GitCommand.Cmd.New("git flow " + branchType + " finish " + suffix),
) )
@ -56,7 +56,7 @@ func (gui *Gui) handleCreateGitFlowMenu() error {
return gui.prompt(promptOpts{ return gui.prompt(promptOpts{
title: title, title: title,
handleConfirm: func(name string) error { handleConfirm: func(name string) error {
gui.logSpan(gui.Tr.Spans.GitFlowStart) gui.logAction(gui.Tr.Actions.GitFlowStart)
return gui.runSubprocessWithSuspenseAndRefresh( return gui.runSubprocessWithSuspenseAndRefresh(
gui.GitCommand.Cmd.New("git flow " + branchType + " start " + name), gui.GitCommand.Cmd.New("git flow " + branchType + " start " + name),
) )

View File

@ -210,13 +210,13 @@ func (gui *Gui) handleMouseDownSecondary() error {
return nil return nil
} }
func (gui *Gui) fetch(canPromptForCredentials bool, span string) (err error) { func (gui *Gui) fetch(canPromptForCredentials bool, action string) (err error) {
gui.Mutexes.FetchMutex.Lock() gui.Mutexes.FetchMutex.Lock()
defer gui.Mutexes.FetchMutex.Unlock() defer gui.Mutexes.FetchMutex.Unlock()
fetchOpts := commands.FetchOptions{} fetchOpts := commands.FetchOptions{}
if canPromptForCredentials { if canPromptForCredentials {
gui.logSpan(span) gui.logAction(action)
fetchOpts.PromptUserForCredential = gui.promptUserForCredential fetchOpts.PromptUserForCredential = gui.promptUserForCredential
} }
@ -239,7 +239,7 @@ func (gui *Gui) handleCopySelectedSideContextItemToClipboard() error {
return nil return nil
} }
gui.logSpan(gui.Tr.Spans.CopyToClipboard) gui.logAction(gui.Tr.Actions.CopyToClipboard)
if err := gui.OSCommand.CopyToClipboard(itemId); err != nil { if err := gui.OSCommand.CopyToClipboard(itemId); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }

View File

@ -13,6 +13,8 @@ import (
// we don't need to see a loading status if we're in a subprocess. // we don't need to see a loading status if we're in a subprocess.
// TODO: work out if we actually need to use a shell command here // TODO: work out if we actually need to use a shell command here
func (gui *Gui) withGpgHandling(cmdObj oscommands.ICmdObj, waitingStatus string, onSuccess func() error) error { func (gui *Gui) withGpgHandling(cmdObj oscommands.ICmdObj, waitingStatus string, onSuccess func() error) error {
gui.logCommand(cmdObj.ToString(), true)
useSubprocess := gui.GitCommand.UsingGpg() useSubprocess := gui.GitCommand.UsingGpg()
if useSubprocess { if useSubprocess {
success, err := gui.runSubprocessWithSuspense(gui.OSCommand.Cmd.NewShell(cmdObj.ToString())) success, err := gui.runSubprocessWithSuspense(gui.OSCommand.Cmd.NewShell(cmdObj.ToString()))

View File

@ -111,8 +111,7 @@ type Gui struct {
PauseBackgroundThreads bool PauseBackgroundThreads bool
// Log of the commands that get run, to be displayed to the user. // Log of the commands that get run, to be displayed to the user.
CmdLog []string CmdLog []string
OnRunCommand func(entry oscommands.CmdLogEntry)
// the extras window contains things like the command log // the extras window contains things like the command log
ShowExtrasWindow bool ShowExtrasWindow bool
@ -457,9 +456,7 @@ func NewGui(cmn *common.Common, gitCommand *commands.GitCommand, oSCommand *osco
gui.watchFilesForChanges() gui.watchFilesForChanges()
onRunCommand := gui.GetOnRunCommand() oSCommand.SetLogCommandFn(gui.logCommand)
oSCommand.SetOnRunCommand(onRunCommand)
gui.OnRunCommand = onRunCommand
gui.PopupHandler = &RealPopupHandler{gui: gui} gui.PopupHandler = &RealPopupHandler{gui: gui}
authors.SetCustomAuthors(gui.UserConfig.Gui.AuthorColors) authors.SetCustomAuthors(gui.UserConfig.Gui.AuthorColors)
@ -625,6 +622,8 @@ func (gui *Gui) runSubprocessWithSuspense(subprocess oscommands.ICmdObj) (bool,
} }
func (gui *Gui) runSubprocess(cmdObj oscommands.ICmdObj) error { func (gui *Gui) runSubprocess(cmdObj oscommands.ICmdObj) error {
gui.logCommand(cmdObj.ToString(), true)
subprocess := cmdObj.GetCmd() subprocess := cmdObj.GetCmd()
subprocess.Stdout = os.Stdout subprocess.Stdout = os.Stdout
subprocess.Stderr = os.Stdout subprocess.Stderr = os.Stdout

View File

@ -90,7 +90,7 @@ func (gui *Gui) copySelectedToClipboard() error {
return gui.withLBLActiveCheck(func(state *LblPanelState) error { return gui.withLBLActiveCheck(func(state *LblPanelState) error {
selected := state.PlainRenderSelected() selected := state.PlainRenderSelected()
gui.logSpan(gui.Tr.Spans.CopySelectedTextToClipboard) gui.logAction(gui.Tr.Actions.CopySelectedTextToClipboard)
if err := gui.OSCommand.CopyToClipboard(selected); err != nil { if err := gui.OSCommand.CopyToClipboard(selected); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }

View File

@ -9,7 +9,6 @@ import (
"github.com/go-errors/errors" "github.com/go-errors/errors"
"github.com/jesseduffield/gocui" "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/commands/types/enums" "github.com/jesseduffield/lazygit/pkg/commands/types/enums"
"github.com/jesseduffield/lazygit/pkg/gui/mergeconflicts" "github.com/jesseduffield/lazygit/pkg/gui/mergeconflicts"
) )
@ -65,7 +64,8 @@ func (gui *Gui) handlePopFileSnapshot() error {
if gitFile == nil { if gitFile == nil {
return nil return nil
} }
gui.OnRunCommand(oscommands.NewCmdLogEntry("Undoing last conflict resolution", "Undo merge conflict resolution", false)) gui.logAction("Restoring file to previous state")
gui.logCommand("Undoing last conflict resolution", false)
if err := ioutil.WriteFile(gitFile.Name, []byte(prevContent), 0644); err != nil { if err := ioutil.WriteFile(gitFile.Name, []byte(prevContent), 0644); err != nil {
return err return err
} }
@ -142,7 +142,8 @@ func (gui *Gui) resolveConflict(selection mergeconflicts.Selection) (bool, error
case mergeconflicts.ALL: case mergeconflicts.ALL:
logStr = "Picking all hunks" logStr = "Picking all hunks"
} }
gui.OnRunCommand(oscommands.NewCmdLogEntry(logStr, "Resolve merge conflict", false)) gui.logAction("Resolve merge conflict")
gui.logCommand(logStr, false)
return true, ioutil.WriteFile(gitFile.Name, []byte(output), 0644) return true, ioutil.WriteFile(gitFile.Name, []byte(output), 0644)
} }

View File

@ -98,7 +98,7 @@ func (gui *Gui) handleDeletePatchFromCommit() error {
return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error {
commitIndex := gui.getPatchCommitIndex() commitIndex := gui.getPatchCommitIndex()
gui.logSpan(gui.Tr.Spans.RemovePatchFromCommit) gui.logAction(gui.Tr.Actions.RemovePatchFromCommit)
err := gui.GitCommand.DeletePatchesFromCommit(gui.State.Commits, commitIndex, gui.GitCommand.PatchManager) err := gui.GitCommand.DeletePatchesFromCommit(gui.State.Commits, commitIndex, gui.GitCommand.PatchManager)
return gui.handleGenericMergeCommandResult(err) return gui.handleGenericMergeCommandResult(err)
}) })
@ -115,7 +115,7 @@ func (gui *Gui) handleMovePatchToSelectedCommit() error {
return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error {
commitIndex := gui.getPatchCommitIndex() commitIndex := gui.getPatchCommitIndex()
gui.logSpan(gui.Tr.Spans.MovePatchToSelectedCommit) gui.logAction(gui.Tr.Actions.MovePatchToSelectedCommit)
err := gui.GitCommand.MovePatchToSelectedCommit(gui.State.Commits, commitIndex, gui.State.Panels.Commits.SelectedLineIdx, gui.GitCommand.PatchManager) err := gui.GitCommand.MovePatchToSelectedCommit(gui.State.Commits, commitIndex, gui.State.Panels.Commits.SelectedLineIdx, gui.GitCommand.PatchManager)
return gui.handleGenericMergeCommandResult(err) return gui.handleGenericMergeCommandResult(err)
}) })
@ -133,7 +133,7 @@ func (gui *Gui) handleMovePatchIntoWorkingTree() error {
pull := func(stash bool) error { pull := func(stash bool) error {
return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error {
commitIndex := gui.getPatchCommitIndex() commitIndex := gui.getPatchCommitIndex()
gui.logSpan(gui.Tr.Spans.MovePatchIntoIndex) gui.logAction(gui.Tr.Actions.MovePatchIntoIndex)
err := gui.GitCommand.MovePatchIntoIndex(gui.State.Commits, commitIndex, gui.GitCommand.PatchManager, stash) err := gui.GitCommand.MovePatchIntoIndex(gui.State.Commits, commitIndex, gui.GitCommand.PatchManager, stash)
return gui.handleGenericMergeCommandResult(err) return gui.handleGenericMergeCommandResult(err)
}) })
@ -163,7 +163,7 @@ func (gui *Gui) handlePullPatchIntoNewCommit() error {
return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.RebasingStatus, func() error {
commitIndex := gui.getPatchCommitIndex() commitIndex := gui.getPatchCommitIndex()
gui.logSpan(gui.Tr.Spans.MovePatchIntoNewCommit) gui.logAction(gui.Tr.Actions.MovePatchIntoNewCommit)
err := gui.GitCommand.PullPatchIntoNewCommit(gui.State.Commits, commitIndex, gui.GitCommand.PatchManager) err := gui.GitCommand.PullPatchIntoNewCommit(gui.State.Commits, commitIndex, gui.GitCommand.PatchManager)
return gui.handleGenericMergeCommandResult(err) return gui.handleGenericMergeCommandResult(err)
}) })
@ -174,11 +174,11 @@ func (gui *Gui) handleApplyPatch(reverse bool) error {
return err return err
} }
span := gui.Tr.Spans.ApplyPatch action := gui.Tr.Actions.ApplyPatch
if reverse { if reverse {
span = "Apply patch in reverse" action = "Apply patch in reverse"
} }
gui.logSpan(span) gui.logAction(action)
if err := gui.GitCommand.PatchManager.ApplyPatches(reverse); err != nil { if err := gui.GitCommand.PatchManager.ApplyPatches(reverse); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }

View File

@ -5,7 +5,6 @@ import (
"github.com/jesseduffield/lazygit/pkg/commands/hosting_service" "github.com/jesseduffield/lazygit/pkg/commands/hosting_service"
"github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
) )
func (gui *Gui) createPullRequestMenu(selectedBranch *models.Branch, checkedOutBranch *models.Branch) error { func (gui *Gui) createPullRequestMenu(selectedBranch *models.Branch, checkedOutBranch *models.Branch) error {
@ -62,12 +61,12 @@ func (gui *Gui) createPullRequest(from string, to string) error {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
gui.logAction(gui.Tr.CreatePullRequest)
if err := gui.GitCommand.OSCommand.OpenLink(url); err != nil { if err := gui.GitCommand.OSCommand.OpenLink(url); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
gui.OnRunCommand(oscommands.NewCmdLogEntry(fmt.Sprintf(gui.Tr.CreatingPullRequestAtUrl, url), gui.Tr.CreatePullRequest, false))
return nil return nil
} }

View File

@ -51,7 +51,7 @@ func (gui *Gui) genericMergeCommand(command string) error {
return gui.createErrorPanel(gui.Tr.NotMergingOrRebasing) return gui.createErrorPanel(gui.Tr.NotMergingOrRebasing)
} }
gui.logSpan(fmt.Sprintf("Merge/Rebase: %s", command)) gui.logAction(fmt.Sprintf("Merge/Rebase: %s", command))
commandType := "" commandType := ""
switch status { switch status {

View File

@ -93,7 +93,7 @@ func (gui *Gui) handleCheckoutReflogCommit() error {
title: gui.Tr.LcCheckoutCommit, title: gui.Tr.LcCheckoutCommit,
prompt: gui.Tr.SureCheckoutThisCommit, prompt: gui.Tr.SureCheckoutThisCommit,
handleConfirm: func() error { handleConfirm: func() error {
gui.logSpan(gui.Tr.Spans.CheckoutReflogCommit) gui.logAction(gui.Tr.Actions.CheckoutReflogCommit)
return gui.handleCheckoutRef(commit.Sha, handleCheckoutRefOptions{}) return gui.handleCheckoutRef(commit.Sha, handleCheckoutRefOptions{})
}, },
}) })

View File

@ -57,7 +57,7 @@ func (gui *Gui) handleDeleteRemoteBranch() error {
prompt: message, prompt: message,
handleConfirm: func() error { handleConfirm: func() error {
return gui.WithWaitingStatus(gui.Tr.DeletingStatus, func() error { return gui.WithWaitingStatus(gui.Tr.DeletingStatus, func() error {
gui.logSpan(gui.Tr.Spans.DeleteRemoteBranch) gui.logAction(gui.Tr.Actions.DeleteRemoteBranch)
err := gui.GitCommand.DeleteRemoteBranch(remoteBranch.RemoteName, remoteBranch.Name, gui.promptUserForCredential) err := gui.GitCommand.DeleteRemoteBranch(remoteBranch.RemoteName, remoteBranch.Name, gui.promptUserForCredential)
gui.handleCredentialsPopup(err) gui.handleCredentialsPopup(err)
@ -88,7 +88,7 @@ func (gui *Gui) handleSetBranchUpstream() error {
title: gui.Tr.SetUpstreamTitle, title: gui.Tr.SetUpstreamTitle,
prompt: message, prompt: message,
handleConfirm: func() error { handleConfirm: func() error {
gui.logSpan(gui.Tr.Spans.SetBranchUpstream) gui.logAction(gui.Tr.Actions.SetBranchUpstream)
if err := gui.GitCommand.SetBranchUpstream(selectedBranch.RemoteName, selectedBranch.Name, checkedOutBranch.Name); err != nil { if err := gui.GitCommand.SetBranchUpstream(selectedBranch.RemoteName, selectedBranch.Name, checkedOutBranch.Name); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }

View File

@ -85,7 +85,7 @@ func (gui *Gui) handleAddRemote() error {
return gui.prompt(promptOpts{ return gui.prompt(promptOpts{
title: gui.Tr.LcNewRemoteUrl, title: gui.Tr.LcNewRemoteUrl,
handleConfirm: func(remoteUrl string) error { handleConfirm: func(remoteUrl string) error {
gui.logSpan(gui.Tr.Spans.AddRemote) gui.logAction(gui.Tr.Actions.AddRemote)
if err := gui.GitCommand.AddRemote(remoteName, remoteUrl); err != nil { if err := gui.GitCommand.AddRemote(remoteName, remoteUrl); err != nil {
return err return err
} }
@ -107,7 +107,7 @@ func (gui *Gui) handleRemoveRemote() error {
title: gui.Tr.LcRemoveRemote, title: gui.Tr.LcRemoveRemote,
prompt: gui.Tr.LcRemoveRemotePrompt + " '" + remote.Name + "'?", prompt: gui.Tr.LcRemoveRemotePrompt + " '" + remote.Name + "'?",
handleConfirm: func() error { handleConfirm: func() error {
gui.logSpan(gui.Tr.Spans.RemoveRemote) gui.logAction(gui.Tr.Actions.RemoveRemote)
if err := gui.GitCommand.RemoveRemote(remote.Name); err != nil { if err := gui.GitCommand.RemoveRemote(remote.Name); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -135,7 +135,7 @@ func (gui *Gui) handleEditRemote() error {
initialContent: remote.Name, initialContent: remote.Name,
handleConfirm: func(updatedRemoteName string) error { handleConfirm: func(updatedRemoteName string) error {
if updatedRemoteName != remote.Name { if updatedRemoteName != remote.Name {
gui.logSpan(gui.Tr.Spans.UpdateRemote) gui.logAction(gui.Tr.Actions.UpdateRemote)
if err := gui.GitCommand.RenameRemote(remote.Name, updatedRemoteName); err != nil { if err := gui.GitCommand.RenameRemote(remote.Name, updatedRemoteName); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -158,7 +158,7 @@ func (gui *Gui) handleEditRemote() error {
title: editUrlMessage, title: editUrlMessage,
initialContent: url, initialContent: url,
handleConfirm: func(updatedRemoteUrl string) error { handleConfirm: func(updatedRemoteUrl string) error {
gui.logSpan(gui.Tr.Spans.UpdateRemote) gui.logAction(gui.Tr.Actions.UpdateRemote)
if err := gui.GitCommand.UpdateRemoteUrl(updatedRemoteName, updatedRemoteUrl); err != nil { if err := gui.GitCommand.UpdateRemoteUrl(updatedRemoteName, updatedRemoteUrl); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }

View File

@ -38,7 +38,7 @@ func (gui *Gui) createResetMenu(ref string) error {
style.FgRed.Sprintf("reset --%s %s", strength, ref), style.FgRed.Sprintf("reset --%s %s", strength, ref),
}, },
onPress: func() error { onPress: func() error {
gui.logSpan("Reset") gui.logAction("Reset")
return gui.resetToRef(ref, strength, []string{}) return gui.resetToRef(ref, strength, []string{})
}, },
} }

View File

@ -143,7 +143,7 @@ func (gui *Gui) applySelection(reverse bool, state *LblPanelState) error {
if !reverse || state.SecondaryFocused { if !reverse || state.SecondaryFocused {
applyFlags = append(applyFlags, "cached") applyFlags = append(applyFlags, "cached")
} }
gui.logSpan(gui.Tr.Spans.ApplyPatch) gui.logAction(gui.Tr.Actions.ApplyPatch)
err := gui.GitCommand.ApplyPatch(patch, applyFlags...) err := gui.GitCommand.ApplyPatch(patch, applyFlags...)
if err != nil { if err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)

View File

@ -106,7 +106,7 @@ func (gui *Gui) stashDo(method string) error {
return gui.createErrorPanel(errorMessage) return gui.createErrorPanel(errorMessage)
} }
gui.logSpan(gui.Tr.Spans.Stash) gui.logAction(gui.Tr.Actions.Stash)
if err := gui.GitCommand.StashDo(stashEntry.Index, method); err != nil { if err := gui.GitCommand.StashDo(stashEntry.Index, method); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }

View File

@ -46,7 +46,7 @@ func (gui *Gui) handleCheckoutSubCommit() error {
title: gui.Tr.LcCheckoutCommit, title: gui.Tr.LcCheckoutCommit,
prompt: gui.Tr.SureCheckoutThisCommit, prompt: gui.Tr.SureCheckoutThisCommit,
handleConfirm: func() error { handleConfirm: func() error {
gui.logSpan(gui.Tr.Spans.CheckoutCommit) gui.logAction(gui.Tr.Actions.CheckoutCommit)
return gui.handleCheckoutRef(commit.Sha, handleCheckoutRefOptions{}) return gui.handleCheckoutRef(commit.Sha, handleCheckoutRefOptions{})
}, },
}) })

View File

@ -79,7 +79,7 @@ func (gui *Gui) removeSubmodule(submodule *models.SubmoduleConfig) error {
title: gui.Tr.RemoveSubmodule, title: gui.Tr.RemoveSubmodule,
prompt: fmt.Sprintf(gui.Tr.RemoveSubmodulePrompt, submodule.Name), prompt: fmt.Sprintf(gui.Tr.RemoveSubmodulePrompt, submodule.Name),
handleConfirm: func() error { handleConfirm: func() error {
gui.logSpan(gui.Tr.Spans.RemoveSubmodule) gui.logAction(gui.Tr.Actions.RemoveSubmodule)
if err := gui.GitCommand.SubmoduleDelete(submodule); err != nil { if err := gui.GitCommand.SubmoduleDelete(submodule); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -106,7 +106,7 @@ func (gui *Gui) fileForSubmodule(submodule *models.SubmoduleConfig) *models.File
} }
func (gui *Gui) resetSubmodule(submodule *models.SubmoduleConfig) error { func (gui *Gui) resetSubmodule(submodule *models.SubmoduleConfig) error {
gui.logSpan(gui.Tr.Spans.ResetSubmodule) gui.logAction(gui.Tr.Actions.ResetSubmodule)
file := gui.fileForSubmodule(submodule) file := gui.fileForSubmodule(submodule)
if file != nil { if file != nil {
@ -141,7 +141,7 @@ func (gui *Gui) handleAddSubmodule() error {
initialContent: submoduleName, initialContent: submoduleName,
handleConfirm: func(submodulePath string) error { handleConfirm: func(submodulePath string) error {
return gui.WithWaitingStatus(gui.Tr.LcAddingSubmoduleStatus, func() error { return gui.WithWaitingStatus(gui.Tr.LcAddingSubmoduleStatus, func() error {
gui.logSpan(gui.Tr.Spans.AddSubmodule) gui.logAction(gui.Tr.Actions.AddSubmodule)
err := gui.GitCommand.SubmoduleAdd(submoduleName, submodulePath, submoduleUrl) err := gui.GitCommand.SubmoduleAdd(submoduleName, submodulePath, submoduleUrl)
gui.handleCredentialsPopup(err) gui.handleCredentialsPopup(err)
@ -162,7 +162,7 @@ func (gui *Gui) handleEditSubmoduleUrl(submodule *models.SubmoduleConfig) error
initialContent: submodule.Url, initialContent: submodule.Url,
handleConfirm: func(newUrl string) error { handleConfirm: func(newUrl string) error {
return gui.WithWaitingStatus(gui.Tr.LcUpdatingSubmoduleUrlStatus, func() error { return gui.WithWaitingStatus(gui.Tr.LcUpdatingSubmoduleUrlStatus, func() error {
gui.logSpan(gui.Tr.Spans.UpdateSubmoduleUrl) gui.logAction(gui.Tr.Actions.UpdateSubmoduleUrl)
err := gui.GitCommand.SubmoduleUpdateUrl(submodule.Name, submodule.Path, newUrl) err := gui.GitCommand.SubmoduleUpdateUrl(submodule.Name, submodule.Path, newUrl)
gui.handleCredentialsPopup(err) gui.handleCredentialsPopup(err)
@ -174,7 +174,7 @@ func (gui *Gui) handleEditSubmoduleUrl(submodule *models.SubmoduleConfig) error
func (gui *Gui) handleSubmoduleInit(submodule *models.SubmoduleConfig) error { func (gui *Gui) handleSubmoduleInit(submodule *models.SubmoduleConfig) error {
return gui.WithWaitingStatus(gui.Tr.LcInitializingSubmoduleStatus, func() error { return gui.WithWaitingStatus(gui.Tr.LcInitializingSubmoduleStatus, func() error {
gui.logSpan(gui.Tr.Spans.InitialiseSubmodule) gui.logAction(gui.Tr.Actions.InitialiseSubmodule)
err := gui.GitCommand.SubmoduleInit(submodule.Path) err := gui.GitCommand.SubmoduleInit(submodule.Path)
gui.handleCredentialsPopup(err) gui.handleCredentialsPopup(err)
@ -218,7 +218,7 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error {
displayStrings: []string{gui.Tr.LcBulkInitSubmodules, style.FgGreen.Sprint(gui.GitCommand.SubmoduleBulkInitCmdObj().ToString())}, displayStrings: []string{gui.Tr.LcBulkInitSubmodules, style.FgGreen.Sprint(gui.GitCommand.SubmoduleBulkInitCmdObj().ToString())},
onPress: func() error { onPress: func() error {
return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error { return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error {
gui.logSpan(gui.Tr.Spans.BulkInitialiseSubmodules) gui.logAction(gui.Tr.Actions.BulkInitialiseSubmodules)
err := gui.GitCommand.SubmoduleBulkInitCmdObj().Run() err := gui.GitCommand.SubmoduleBulkInitCmdObj().Run()
if err != nil { if err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
@ -232,7 +232,7 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error {
displayStrings: []string{gui.Tr.LcBulkUpdateSubmodules, style.FgYellow.Sprint(gui.GitCommand.SubmoduleBulkUpdateCmdObj().ToString())}, displayStrings: []string{gui.Tr.LcBulkUpdateSubmodules, style.FgYellow.Sprint(gui.GitCommand.SubmoduleBulkUpdateCmdObj().ToString())},
onPress: func() error { onPress: func() error {
return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error { return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error {
gui.logSpan(gui.Tr.Spans.BulkUpdateSubmodules) gui.logAction(gui.Tr.Actions.BulkUpdateSubmodules)
if err := gui.GitCommand.SubmoduleBulkUpdateCmdObj().Run(); err != nil { if err := gui.GitCommand.SubmoduleBulkUpdateCmdObj().Run(); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -245,7 +245,7 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error {
displayStrings: []string{gui.Tr.LcSubmoduleStashAndReset, style.FgRed.Sprintf("git stash in each submodule && %s", gui.GitCommand.SubmoduleForceBulkUpdateCmdObj().ToString())}, displayStrings: []string{gui.Tr.LcSubmoduleStashAndReset, style.FgRed.Sprintf("git stash in each submodule && %s", gui.GitCommand.SubmoduleForceBulkUpdateCmdObj().ToString())},
onPress: func() error { onPress: func() error {
return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error { return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error {
gui.logSpan(gui.Tr.Spans.BulkStashAndResetSubmodules) gui.logAction(gui.Tr.Actions.BulkStashAndResetSubmodules)
if err := gui.GitCommand.ResetSubmodules(gui.State.Submodules); err != nil { if err := gui.GitCommand.ResetSubmodules(gui.State.Submodules); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -258,7 +258,7 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error {
displayStrings: []string{gui.Tr.LcBulkDeinitSubmodules, style.FgRed.Sprint(gui.GitCommand.SubmoduleBulkDeinitCmdObj().ToString())}, displayStrings: []string{gui.Tr.LcBulkDeinitSubmodules, style.FgRed.Sprint(gui.GitCommand.SubmoduleBulkDeinitCmdObj().ToString())},
onPress: func() error { onPress: func() error {
return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error { return gui.WithWaitingStatus(gui.Tr.LcRunningCommand, func() error {
gui.logSpan(gui.Tr.Spans.BulkDeinitialiseSubmodules) gui.logAction(gui.Tr.Actions.BulkDeinitialiseSubmodules)
if err := gui.GitCommand.SubmoduleBulkDeinitCmdObj().Run(); err != nil { if err := gui.GitCommand.SubmoduleBulkDeinitCmdObj().Run(); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -274,7 +274,7 @@ func (gui *Gui) handleBulkSubmoduleActionsMenu() error {
func (gui *Gui) handleUpdateSubmodule(submodule *models.SubmoduleConfig) error { func (gui *Gui) handleUpdateSubmodule(submodule *models.SubmoduleConfig) error {
return gui.WithWaitingStatus(gui.Tr.LcUpdatingSubmoduleStatus, func() error { return gui.WithWaitingStatus(gui.Tr.LcUpdatingSubmoduleStatus, func() error {
gui.logSpan(gui.Tr.Spans.UpdateSubmodule) gui.logAction(gui.Tr.Actions.UpdateSubmodule)
err := gui.GitCommand.SubmoduleUpdate(submodule.Path) err := gui.GitCommand.SubmoduleUpdate(submodule.Path)
gui.handleCredentialsPopup(err) gui.handleCredentialsPopup(err)

View File

@ -63,7 +63,7 @@ func (gui *Gui) withSelectedTag(f func(tag *models.Tag) error) func() error {
// tag-specific handlers // tag-specific handlers
func (gui *Gui) handleCheckoutTag(tag *models.Tag) error { func (gui *Gui) handleCheckoutTag(tag *models.Tag) error {
gui.logSpan(gui.Tr.Spans.CheckoutTag) gui.logAction(gui.Tr.Actions.CheckoutTag)
if err := gui.handleCheckoutRef(tag.Name, handleCheckoutRefOptions{}); err != nil { if err := gui.handleCheckoutRef(tag.Name, handleCheckoutRefOptions{}); err != nil {
return err return err
} }
@ -82,7 +82,7 @@ func (gui *Gui) handleDeleteTag(tag *models.Tag) error {
title: gui.Tr.DeleteTagTitle, title: gui.Tr.DeleteTagTitle,
prompt: prompt, prompt: prompt,
handleConfirm: func() error { handleConfirm: func() error {
gui.logSpan(gui.Tr.Spans.DeleteTag) gui.logAction(gui.Tr.Actions.DeleteTag)
if err := gui.GitCommand.DeleteTag(tag.Name); err != nil { if err := gui.GitCommand.DeleteTag(tag.Name); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -105,7 +105,7 @@ func (gui *Gui) handlePushTag(tag *models.Tag) error {
findSuggestionsFunc: gui.getRemoteSuggestionsFunc(), findSuggestionsFunc: gui.getRemoteSuggestionsFunc(),
handleConfirm: func(response string) error { handleConfirm: func(response string) error {
return gui.WithWaitingStatus(gui.Tr.PushingTagStatus, func() error { return gui.WithWaitingStatus(gui.Tr.PushingTagStatus, func() error {
gui.logSpan(gui.Tr.Spans.PushTag) gui.logAction(gui.Tr.Actions.PushTag)
err := gui.GitCommand.PushTag(response, tag.Name, gui.promptUserForCredential) err := gui.GitCommand.PushTag(response, tag.Name, gui.promptUserForCredential)
gui.handleCredentialsPopup(err) gui.handleCredentialsPopup(err)

View File

@ -99,13 +99,13 @@ func (gui *Gui) reflogUndo() error {
switch action.kind { switch action.kind {
case COMMIT, REBASE: case COMMIT, REBASE:
gui.logSpan(gui.Tr.Spans.Undo) gui.logAction(gui.Tr.Actions.Undo)
return true, gui.handleHardResetWithAutoStash(action.from, handleHardResetWithAutoStashOptions{ return true, gui.handleHardResetWithAutoStash(action.from, handleHardResetWithAutoStashOptions{
EnvVars: undoEnvVars, EnvVars: undoEnvVars,
WaitingStatus: undoingStatus, WaitingStatus: undoingStatus,
}) })
case CHECKOUT: case CHECKOUT:
gui.logSpan(gui.Tr.Spans.Undo) gui.logAction(gui.Tr.Actions.Undo)
return true, gui.handleCheckoutRef(action.from, handleCheckoutRefOptions{ return true, gui.handleCheckoutRef(action.from, handleCheckoutRefOptions{
EnvVars: undoEnvVars, EnvVars: undoEnvVars,
WaitingStatus: undoingStatus, WaitingStatus: undoingStatus,
@ -135,13 +135,13 @@ func (gui *Gui) reflogRedo() error {
switch action.kind { switch action.kind {
case COMMIT, REBASE: case COMMIT, REBASE:
gui.logSpan(gui.Tr.Spans.Redo) gui.logAction(gui.Tr.Actions.Redo)
return true, gui.handleHardResetWithAutoStash(action.to, handleHardResetWithAutoStashOptions{ return true, gui.handleHardResetWithAutoStash(action.to, handleHardResetWithAutoStashOptions{
EnvVars: redoEnvVars, EnvVars: redoEnvVars,
WaitingStatus: redoingStatus, WaitingStatus: redoingStatus,
}) })
case CHECKOUT: case CHECKOUT:
gui.logSpan(gui.Tr.Spans.Redo) gui.logAction(gui.Tr.Actions.Redo)
return true, gui.handleCheckoutRef(action.to, handleCheckoutRefOptions{ return true, gui.handleCheckoutRef(action.to, handleCheckoutRefOptions{
EnvVars: redoEnvVars, EnvVars: redoEnvVars,
WaitingStatus: redoingStatus, WaitingStatus: redoingStatus,

View File

@ -21,7 +21,7 @@ func (gui *Gui) handleCreateResetMenu() error {
red.Sprint(nukeStr), red.Sprint(nukeStr),
}, },
onPress: func() error { onPress: func() error {
gui.logSpan(gui.Tr.Spans.NukeWorkingTree) gui.logAction(gui.Tr.Actions.NukeWorkingTree)
if err := gui.GitCommand.ResetAndClean(); err != nil { if err := gui.GitCommand.ResetAndClean(); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -35,7 +35,7 @@ func (gui *Gui) handleCreateResetMenu() error {
red.Sprint("git checkout -- ."), red.Sprint("git checkout -- ."),
}, },
onPress: func() error { onPress: func() error {
gui.logSpan(gui.Tr.Spans.DiscardUnstagedFileChanges) gui.logAction(gui.Tr.Actions.DiscardUnstagedFileChanges)
if err := gui.GitCommand.DiscardAnyUnstagedFileChanges(); err != nil { if err := gui.GitCommand.DiscardAnyUnstagedFileChanges(); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -49,7 +49,7 @@ func (gui *Gui) handleCreateResetMenu() error {
red.Sprint("git clean -fd"), red.Sprint("git clean -fd"),
}, },
onPress: func() error { onPress: func() error {
gui.logSpan(gui.Tr.Spans.RemoveUntrackedFiles) gui.logAction(gui.Tr.Actions.RemoveUntrackedFiles)
if err := gui.GitCommand.RemoveUntrackedFiles(); err != nil { if err := gui.GitCommand.RemoveUntrackedFiles(); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -63,7 +63,7 @@ func (gui *Gui) handleCreateResetMenu() error {
red.Sprint("git reset --soft HEAD"), red.Sprint("git reset --soft HEAD"),
}, },
onPress: func() error { onPress: func() error {
gui.logSpan(gui.Tr.Spans.SoftReset) gui.logAction(gui.Tr.Actions.SoftReset)
if err := gui.GitCommand.ResetSoft("HEAD"); err != nil { if err := gui.GitCommand.ResetSoft("HEAD"); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -77,7 +77,7 @@ func (gui *Gui) handleCreateResetMenu() error {
red.Sprint("git reset --mixed HEAD"), red.Sprint("git reset --mixed HEAD"),
}, },
onPress: func() error { onPress: func() error {
gui.logSpan(gui.Tr.Spans.MixedReset) gui.logAction(gui.Tr.Actions.MixedReset)
if err := gui.GitCommand.ResetMixed("HEAD"); err != nil { if err := gui.GitCommand.ResetMixed("HEAD"); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }
@ -91,7 +91,7 @@ func (gui *Gui) handleCreateResetMenu() error {
red.Sprint("git reset --hard HEAD"), red.Sprint("git reset --hard HEAD"),
}, },
onPress: func() error { onPress: func() error {
gui.logSpan(gui.Tr.Spans.HardReset) gui.logAction(gui.Tr.Actions.HardReset)
if err := gui.GitCommand.ResetHard("HEAD"); err != nil { if err := gui.GitCommand.ResetHard("HEAD"); err != nil {
return gui.surfaceError(err) return gui.surfaceError(err)
} }

View File

@ -441,8 +441,7 @@ func chineseTranslationSet() TranslationSet {
LcCreatePullRequestOptions: "创建抓取请求选项", LcCreatePullRequestOptions: "创建抓取请求选项",
LcDefaultBranch: "默认分支", LcDefaultBranch: "默认分支",
LcSelectBranch: "选择分支", LcSelectBranch: "选择分支",
CreatingPullRequestAtUrl: "在 URL 创建抓取请求: %s", Actions: Actions{
Spans: Spans{
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm) // TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)
CheckoutCommit: "检出提交", CheckoutCommit: "检出提交",
CheckoutReflogCommit: "检出reflog提交", CheckoutReflogCommit: "检出reflog提交",

View File

@ -438,7 +438,6 @@ type TranslationSet struct {
LcDefaultBranch string LcDefaultBranch string
LcSelectBranch string LcSelectBranch string
CreatePullRequest string CreatePullRequest string
CreatingPullRequestAtUrl string
OpeningCommitInBrowser string OpeningCommitInBrowser string
SelectConfigFile string SelectConfigFile string
NoConfigFileFoundErr string NoConfigFileFoundErr string
@ -456,10 +455,10 @@ type TranslationSet struct {
SortCommits string SortCommits string
CantChangeContextSizeError string CantChangeContextSizeError string
LcOpenCommitInBrowser string LcOpenCommitInBrowser string
Spans Spans Actions Actions
} }
type Spans struct { type Actions struct {
CheckoutCommit string CheckoutCommit string
CheckoutReflogCommit string CheckoutReflogCommit string
CheckoutTag string CheckoutTag string
@ -540,6 +539,8 @@ type Spans struct {
HardReset string HardReset string
Undo string Undo string
Redo string Redo string
CopyPullRequestURL string
OpenMergeTool string
} }
const englishIntroPopupMessage = ` const englishIntroPopupMessage = `
@ -989,7 +990,6 @@ func EnglishTranslationSet() TranslationSet {
LcCreatePullRequestOptions: "create pull request options", LcCreatePullRequestOptions: "create pull request options",
LcDefaultBranch: "default branch", LcDefaultBranch: "default branch",
LcSelectBranch: "select branch", LcSelectBranch: "select branch",
CreatingPullRequestAtUrl: "Creating pull request at URL: %s",
OpeningCommitInBrowser: "Opening commit in browser at URL: %s", OpeningCommitInBrowser: "Opening commit in browser at URL: %s",
SelectConfigFile: "Select config file", SelectConfigFile: "Select config file",
NoConfigFileFoundErr: "No config file found", NoConfigFileFoundErr: "No config file found",
@ -1007,7 +1007,7 @@ func EnglishTranslationSet() TranslationSet {
SortCommits: "commit sort order", SortCommits: "commit sort order",
CantChangeContextSizeError: "Cannot change context while in patch building mode because we were too lazy to support it when releasing the feature. If you really want it, please let us know!", CantChangeContextSizeError: "Cannot change context while in patch building mode because we were too lazy to support it when releasing the feature. If you really want it, please let us know!",
LcOpenCommitInBrowser: "open commit in browser", LcOpenCommitInBrowser: "open commit in browser",
Spans: Spans{ Actions: Actions{
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm) // TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)
CheckoutCommit: "Checkout commit", CheckoutCommit: "Checkout commit",
CheckoutReflogCommit: "Checkout reflog commit", CheckoutReflogCommit: "Checkout reflog commit",
@ -1089,6 +1089,8 @@ func EnglishTranslationSet() TranslationSet {
FastForwardBranch: "Fast forward branch", FastForwardBranch: "Fast forward branch",
Undo: "Undo", Undo: "Undo",
Redo: "Redo", Redo: "Redo",
CopyPullRequestURL: "Copy pull request URL",
OpenMergeTool: "Open merge tool",
}, },
} }
} }