diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-10-23 11:25:37 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-10-23 12:29:52 +1100 |
commit | ef544e6ce961add2fcac4004ba6587b2de378e64 (patch) | |
tree | 98d7fe313fe237bcd3b78d654b41c45a2ff4a38c /pkg/gui/files_panel.go | |
parent | 629494144fcef931a9f484821202bcd4370aa23b (diff) |
add more suggestions
Diffstat (limited to 'pkg/gui/files_panel.go')
-rw-r--r-- | pkg/gui/files_panel.go | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 41ac25fb8..0f9bbd65d 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -659,8 +659,9 @@ func (gui *Gui) handlePullFiles() error { } return gui.prompt(promptOpts{ - title: gui.Tr.EnterUpstream, - initialContent: "origin/" + currentBranch.Name, + title: gui.Tr.EnterUpstream, + initialContent: "origin/" + currentBranch.Name, + findSuggestionsFunc: gui.getRemoteBranchesSuggestionsFunc("/"), handleConfirm: func(upstream string) error { if err := gui.GitCommand.SetUpstreamBranch(upstream); err != nil { errorMessage := err.Error() @@ -798,8 +799,9 @@ func (gui *Gui) pushFiles() error { return gui.push(pushOpts{setUpstream: true}) } else { return gui.prompt(promptOpts{ - title: gui.Tr.EnterUpstream, - initialContent: "origin " + currentBranch.Name, + title: gui.Tr.EnterUpstream, + initialContent: "origin " + currentBranch.Name, + findSuggestionsFunc: gui.getRemoteBranchesSuggestionsFunc(" "), handleConfirm: func(upstream string) error { var upstreamBranch, upstreamRemote string split := strings.Split(upstream, " ") @@ -884,8 +886,21 @@ func (gui *Gui) anyFilesWithMergeConflicts() bool { func (gui *Gui) handleCustomCommand() error { return gui.prompt(promptOpts{ - title: gui.Tr.CustomCommand, + title: gui.Tr.CustomCommand, + findSuggestionsFunc: gui.getCustomCommandsHistorySuggestionsFunc(), handleConfirm: func(command string) error { + gui.Config.GetAppState().CustomCommandsHistory = utils.Limit( + utils.Uniq( + append(gui.Config.GetAppState().CustomCommandsHistory, command), + ), + 1000, + ) + + err := gui.Config.SaveAppState() + if err != nil { + gui.Log.Error(err) + } + gui.OnRunCommand(oscommands.NewCmdLogEntry(command, gui.Tr.Spans.CustomCommand, true)) return gui.runSubprocessWithSuspenseAndRefresh( gui.OSCommand.PrepareShellSubProcess(command), |