mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 12:55:47 +02:00
Rename "Custom Command" to "Shell Command"
The double use of the term "Custom Command" for both shell commands and user-configured keybindings was confusing.
This commit is contained in:
parent
0cbe08b105
commit
dbca9306de
22 changed files with 77 additions and 69 deletions
|
@ -495,7 +495,7 @@ keybinding:
|
||||||
scrollDownMain-alt1: J
|
scrollDownMain-alt1: J
|
||||||
scrollUpMain-alt2: <c-u>
|
scrollUpMain-alt2: <c-u>
|
||||||
scrollDownMain-alt2: <c-d>
|
scrollDownMain-alt2: <c-d>
|
||||||
executeCustomCommand: ':'
|
executeShellCommand: ':'
|
||||||
createRebaseOptionsMenu: m
|
createRebaseOptionsMenu: m
|
||||||
|
|
||||||
# 'Files' appended for legacy reasons
|
# 'Files' appended for legacy reasons
|
||||||
|
|
|
@ -18,7 +18,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||||
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
||||||
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. |
|
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. |
|
||||||
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. |
|
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. |
|
||||||
| `` : `` | Execute custom command | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. |
|
| `` : `` | Execute shell command | Bring up a prompt where you can enter a shell command to execute. |
|
||||||
| `` <c-p> `` | View custom patch options | |
|
| `` <c-p> `` | View custom patch options | |
|
||||||
| `` m `` | View merge/rebase options | View options to abort/continue/skip the current merge/rebase. |
|
| `` m `` | View merge/rebase options | View options to abort/continue/skip the current merge/rebase. |
|
||||||
| `` R `` | Refresh | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
| `` R `` | Refresh | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||||
|
|
|
@ -18,7 +18,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||||
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
||||||
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. |
|
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. |
|
||||||
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. |
|
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. |
|
||||||
| `` : `` | カスタムコマンドを実行 | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. |
|
| `` : `` | Execute shell command | Bring up a prompt where you can enter a shell command to execute. |
|
||||||
| `` <c-p> `` | View custom patch options | |
|
| `` <c-p> `` | View custom patch options | |
|
||||||
| `` m `` | View merge/rebase options | View options to abort/continue/skip the current merge/rebase. |
|
| `` m `` | View merge/rebase options | View options to abort/continue/skip the current merge/rebase. |
|
||||||
| `` R `` | リフレッシュ | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
| `` R `` | リフレッシュ | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||||
|
|
|
@ -18,7 +18,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||||
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
||||||
| `` } `` | Diff 보기의 변경 사항 주위에 표시되는 컨텍스트의 크기를 늘리기 | Increase the amount of the context shown around changes in the diff view. |
|
| `` } `` | Diff 보기의 변경 사항 주위에 표시되는 컨텍스트의 크기를 늘리기 | Increase the amount of the context shown around changes in the diff view. |
|
||||||
| `` { `` | Diff 보기의 변경 사항 주위에 표시되는 컨텍스트 크기 줄이기 | Decrease the amount of the context shown around changes in the diff view. |
|
| `` { `` | Diff 보기의 변경 사항 주위에 표시되는 컨텍스트 크기 줄이기 | Decrease the amount of the context shown around changes in the diff view. |
|
||||||
| `` : `` | Execute custom command | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. |
|
| `` : `` | Execute shell command | Bring up a prompt where you can enter a shell command to execute. |
|
||||||
| `` <c-p> `` | 커스텀 Patch 옵션 보기 | |
|
| `` <c-p> `` | 커스텀 Patch 옵션 보기 | |
|
||||||
| `` m `` | View merge/rebase options | View options to abort/continue/skip the current merge/rebase. |
|
| `` m `` | View merge/rebase options | View options to abort/continue/skip the current merge/rebase. |
|
||||||
| `` R `` | 새로고침 | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
| `` R `` | 새로고침 | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||||
|
|
|
@ -18,7 +18,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||||
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
||||||
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. |
|
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. |
|
||||||
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. |
|
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. |
|
||||||
| `` : `` | Voer aangepaste commando uit | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. |
|
| `` : `` | Execute shell command | Bring up a prompt where you can enter a shell command to execute. |
|
||||||
| `` <c-p> `` | Bekijk aangepaste patch opties | |
|
| `` <c-p> `` | Bekijk aangepaste patch opties | |
|
||||||
| `` m `` | Bekijk merge/rebase opties | View options to abort/continue/skip the current merge/rebase. |
|
| `` m `` | Bekijk merge/rebase opties | View options to abort/continue/skip the current merge/rebase. |
|
||||||
| `` R `` | Verversen | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
| `` R `` | Verversen | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||||
|
|
|
@ -18,7 +18,7 @@ _Legenda: `<c-b>` oznacza ctrl+b, `<a-b>` oznacza alt+b, `B` oznacza shift+b_
|
||||||
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
||||||
| `` } `` | Zwiększ rozmiar kontekstu w widoku różnic | Zwiększ ilość kontekstu pokazywanego wokół zmian w widoku różnic. |
|
| `` } `` | Zwiększ rozmiar kontekstu w widoku różnic | Zwiększ ilość kontekstu pokazywanego wokół zmian w widoku różnic. |
|
||||||
| `` { `` | Zmniejsz rozmiar kontekstu w widoku różnic | Zmniejsz ilość kontekstu pokazywanego wokół zmian w widoku różnic. |
|
| `` { `` | Zmniejsz rozmiar kontekstu w widoku różnic | Zmniejsz ilość kontekstu pokazywanego wokół zmian w widoku różnic. |
|
||||||
| `` : `` | Wykonaj polecenie niestandardowe | Wyświetl monit, w którym możesz wprowadzić polecenie powłoki do wykonania. Nie należy mylić z wcześniej skonfigurowanymi poleceniami niestandardowymi. |
|
| `` : `` | Execute shell command | Bring up a prompt where you can enter a shell command to execute. |
|
||||||
| `` <c-p> `` | Wyświetl opcje niestandardowej łatki | |
|
| `` <c-p> `` | Wyświetl opcje niestandardowej łatki | |
|
||||||
| `` m `` | Pokaż opcje scalania/rebase | Pokaż opcje do przerwania/kontynuowania/pominięcia bieżącego scalania/rebase. |
|
| `` m `` | Pokaż opcje scalania/rebase | Pokaż opcje do przerwania/kontynuowania/pominięcia bieżącego scalania/rebase. |
|
||||||
| `` R `` | Odśwież | Odśwież stan git (tj. uruchom `git status`, `git branch`, itp. w tle, aby zaktualizować zawartość paneli). To nie uruchamia `git fetch`. |
|
| `` R `` | Odśwież | Odśwież stan git (tj. uruchom `git status`, `git branch`, itp. w tle, aby zaktualizować zawartość paneli). To nie uruchamia `git fetch`. |
|
||||||
|
|
|
@ -18,7 +18,7 @@ _Связки клавиш_
|
||||||
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
||||||
| `` } `` | Увеличить размер контекста, отображаемого вокруг изменений в просмотрщике сравнении | Increase the amount of the context shown around changes in the diff view. |
|
| `` } `` | Увеличить размер контекста, отображаемого вокруг изменений в просмотрщике сравнении | Increase the amount of the context shown around changes in the diff view. |
|
||||||
| `` { `` | Уменьшите размер контекста, отображаемого вокруг изменений в просмотрщике сравнении | Decrease the amount of the context shown around changes in the diff view. |
|
| `` { `` | Уменьшите размер контекста, отображаемого вокруг изменений в просмотрщике сравнении | Decrease the amount of the context shown around changes in the diff view. |
|
||||||
| `` : `` | Выполнить пользовательскую команду | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. |
|
| `` : `` | Execute shell command | Bring up a prompt where you can enter a shell command to execute. |
|
||||||
| `` <c-p> `` | Просмотреть пользовательские параметры патча | |
|
| `` <c-p> `` | Просмотреть пользовательские параметры патча | |
|
||||||
| `` m `` | Просмотреть параметры слияния/перебазирования | View options to abort/continue/skip the current merge/rebase. |
|
| `` m `` | Просмотреть параметры слияния/перебазирования | View options to abort/continue/skip the current merge/rebase. |
|
||||||
| `` R `` | Обновить | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
| `` R `` | Обновить | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||||
|
|
|
@ -18,7 +18,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||||
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
||||||
| `` } `` | 扩大差异视图中显示的上下文范围 | Increase the amount of the context shown around changes in the diff view. |
|
| `` } `` | 扩大差异视图中显示的上下文范围 | Increase the amount of the context shown around changes in the diff view. |
|
||||||
| `` { `` | 缩小差异视图中显示的上下文范围 | Decrease the amount of the context shown around changes in the diff view. |
|
| `` { `` | 缩小差异视图中显示的上下文范围 | Decrease the amount of the context shown around changes in the diff view. |
|
||||||
| `` : `` | 执行自定义命令 | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. |
|
| `` : `` | Execute shell command | Bring up a prompt where you can enter a shell command to execute. |
|
||||||
| `` <c-p> `` | 查看自定义补丁选项 | |
|
| `` <c-p> `` | 查看自定义补丁选项 | |
|
||||||
| `` m `` | 查看 合并/变基 选项 | View options to abort/continue/skip the current merge/rebase. |
|
| `` m `` | 查看 合并/变基 选项 | View options to abort/continue/skip the current merge/rebase. |
|
||||||
| `` R `` | 刷新 | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
| `` R `` | 刷新 | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||||
|
|
|
@ -18,7 +18,7 @@ _說明:`<c-b>` 表示 Ctrl+B、`<a-b>` 表示 Alt+B,`B`表示 Shift+B
|
||||||
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
||||||
| `` } `` | 增加差異檢視中顯示變更周圍上下文的大小 | Increase the amount of the context shown around changes in the diff view. |
|
| `` } `` | 增加差異檢視中顯示變更周圍上下文的大小 | Increase the amount of the context shown around changes in the diff view. |
|
||||||
| `` { `` | 減小差異檢視中顯示變更周圍上下文的大小 | Decrease the amount of the context shown around changes in the diff view. |
|
| `` { `` | 減小差異檢視中顯示變更周圍上下文的大小 | Decrease the amount of the context shown around changes in the diff view. |
|
||||||
| `` : `` | 執行自訂命令 | Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands. |
|
| `` : `` | Execute shell command | Bring up a prompt where you can enter a shell command to execute. |
|
||||||
| `` <c-p> `` | 檢視自訂補丁選項 | |
|
| `` <c-p> `` | 檢視自訂補丁選項 | |
|
||||||
| `` m `` | 查看合併/變基選項 | View options to abort/continue/skip the current merge/rebase. |
|
| `` m `` | 查看合併/變基選項 | View options to abort/continue/skip the current merge/rebase. |
|
||||||
| `` R `` | 重新整理 | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
| `` R `` | 重新整理 | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||||
|
|
|
@ -184,6 +184,12 @@ func migrateUserConfig(path string, content []byte) ([]byte, error) {
|
||||||
return nil, fmt.Errorf("Couldn't migrate config file at `%s`: %s", path, err)
|
return nil, fmt.Errorf("Couldn't migrate config file at `%s`: %s", path, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changedContent, err = yaml_utils.RenameYamlKey(changedContent, []string{"keybinding", "universal", "executeCustomCommand"},
|
||||||
|
"executeShellCommand")
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("Couldn't migrate config file at `%s`: %s", path, err)
|
||||||
|
}
|
||||||
|
|
||||||
changedContent, err = changeNullKeybindingsToDisabled(changedContent)
|
changedContent, err = changeNullKeybindingsToDisabled(changedContent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Couldn't migrate config file at `%s`: %s", path, err)
|
return nil, fmt.Errorf("Couldn't migrate config file at `%s`: %s", path, err)
|
||||||
|
@ -365,8 +371,10 @@ type AppState struct {
|
||||||
StartupPopupVersion int
|
StartupPopupVersion int
|
||||||
LastVersion string // this is the last version the user was using, for the purpose of showing release notes
|
LastVersion string // this is the last version the user was using, for the purpose of showing release notes
|
||||||
|
|
||||||
// these are for custom commands typed in directly, not for custom commands in the lazygit config
|
// these are for shell commands typed in directly, not for custom commands in the lazygit config.
|
||||||
CustomCommandsHistory []string
|
// For backwards compatibility we keep the old name in yaml files.
|
||||||
|
ShellCommandsHistory []string `yaml:"customcommandshistory"`
|
||||||
|
|
||||||
HideCommandLog bool
|
HideCommandLog bool
|
||||||
IgnoreWhitespaceInDiffView bool
|
IgnoreWhitespaceInDiffView bool
|
||||||
DiffContextSize int
|
DiffContextSize int
|
||||||
|
|
|
@ -385,7 +385,7 @@ type KeybindingUniversalConfig struct {
|
||||||
ScrollDownMainAlt1 string `yaml:"scrollDownMain-alt1"`
|
ScrollDownMainAlt1 string `yaml:"scrollDownMain-alt1"`
|
||||||
ScrollUpMainAlt2 string `yaml:"scrollUpMain-alt2"`
|
ScrollUpMainAlt2 string `yaml:"scrollUpMain-alt2"`
|
||||||
ScrollDownMainAlt2 string `yaml:"scrollDownMain-alt2"`
|
ScrollDownMainAlt2 string `yaml:"scrollDownMain-alt2"`
|
||||||
ExecuteCustomCommand string `yaml:"executeCustomCommand"`
|
ExecuteShellCommand string `yaml:"executeShellCommand"`
|
||||||
CreateRebaseOptionsMenu string `yaml:"createRebaseOptionsMenu"`
|
CreateRebaseOptionsMenu string `yaml:"createRebaseOptionsMenu"`
|
||||||
Push string `yaml:"pushFiles"` // 'Files' appended for legacy reasons
|
Push string `yaml:"pushFiles"` // 'Files' appended for legacy reasons
|
||||||
Pull string `yaml:"pullFiles"` // 'Files' appended for legacy reasons
|
Pull string `yaml:"pullFiles"` // 'Files' appended for legacy reasons
|
||||||
|
@ -824,7 +824,7 @@ func GetDefaultConfig() *UserConfig {
|
||||||
ScrollDownMainAlt1: "J",
|
ScrollDownMainAlt1: "J",
|
||||||
ScrollUpMainAlt2: "<c-u>",
|
ScrollUpMainAlt2: "<c-u>",
|
||||||
ScrollDownMainAlt2: "<c-d>",
|
ScrollDownMainAlt2: "<c-d>",
|
||||||
ExecuteCustomCommand: ":",
|
ExecuteShellCommand: ":",
|
||||||
CreateRebaseOptionsMenu: "m",
|
CreateRebaseOptionsMenu: "m",
|
||||||
Push: "P",
|
Push: "P",
|
||||||
Pull: "p",
|
Pull: "p",
|
||||||
|
|
|
@ -22,10 +22,10 @@ func NewGlobalController(
|
||||||
func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
|
func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
|
||||||
return []*types.Binding{
|
return []*types.Binding{
|
||||||
{
|
{
|
||||||
Key: opts.GetKey(opts.Config.Universal.ExecuteCustomCommand),
|
Key: opts.GetKey(opts.Config.Universal.ExecuteShellCommand),
|
||||||
Handler: self.customCommand,
|
Handler: self.shellCommand,
|
||||||
Description: self.c.Tr.ExecuteCustomCommand,
|
Description: self.c.Tr.ExecuteShellCommand,
|
||||||
Tooltip: self.c.Tr.ExecuteCustomCommandTooltip,
|
Tooltip: self.c.Tr.ExecuteShellCommandTooltip,
|
||||||
OpensMenu: true,
|
OpensMenu: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -132,8 +132,8 @@ func (self *GlobalController) Context() types.Context {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *GlobalController) customCommand() error {
|
func (self *GlobalController) shellCommand() error {
|
||||||
return (&CustomCommandAction{c: self.c}).Call()
|
return (&ShellCommandAction{c: self.c}).Call()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *GlobalController) createCustomPatchOptionsMenu() error {
|
func (self *GlobalController) createCustomPatchOptionsMenu() error {
|
||||||
|
|
|
@ -10,19 +10,19 @@ import (
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CustomCommandAction struct {
|
type ShellCommandAction struct {
|
||||||
c *ControllerCommon
|
c *ControllerCommon
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *CustomCommandAction) Call() error {
|
func (self *ShellCommandAction) Call() error {
|
||||||
return self.c.Prompt(types.PromptOpts{
|
return self.c.Prompt(types.PromptOpts{
|
||||||
Title: self.c.Tr.CustomCommand,
|
Title: self.c.Tr.ShellCommand,
|
||||||
FindSuggestionsFunc: self.GetCustomCommandsHistorySuggestionsFunc(),
|
FindSuggestionsFunc: self.GetShellCommandsHistorySuggestionsFunc(),
|
||||||
AllowEditSuggestion: true,
|
AllowEditSuggestion: true,
|
||||||
HandleConfirm: func(command string) error {
|
HandleConfirm: func(command string) error {
|
||||||
if self.shouldSaveCommand(command) {
|
if self.shouldSaveCommand(command) {
|
||||||
self.c.GetAppState().CustomCommandsHistory = utils.Limit(
|
self.c.GetAppState().ShellCommandsHistory = utils.Limit(
|
||||||
lo.Uniq(append([]string{command}, self.c.GetAppState().CustomCommandsHistory...)),
|
lo.Uniq(append([]string{command}, self.c.GetAppState().ShellCommandsHistory...)),
|
||||||
1000,
|
1000,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -38,17 +38,17 @@ func (self *CustomCommandAction) Call() error {
|
||||||
// index is the index in the _filtered_ list of suggestions, so we
|
// index is the index in the _filtered_ list of suggestions, so we
|
||||||
// need to map it back to the full list. There's no really good way
|
// need to map it back to the full list. There's no really good way
|
||||||
// to do this, but fortunately we keep the items in the
|
// to do this, but fortunately we keep the items in the
|
||||||
// CustomCommandsHistory unique, which allows us to simply search
|
// ShellCommandsHistory unique, which allows us to simply search
|
||||||
// for it by string.
|
// for it by string.
|
||||||
item := self.c.Contexts().Suggestions.GetItems()[index].Value
|
item := self.c.Contexts().Suggestions.GetItems()[index].Value
|
||||||
fullIndex := lo.IndexOf(self.c.GetAppState().CustomCommandsHistory, item)
|
fullIndex := lo.IndexOf(self.c.GetAppState().ShellCommandsHistory, item)
|
||||||
if fullIndex == -1 {
|
if fullIndex == -1 {
|
||||||
// Should never happen, but better be safe
|
// Should never happen, but better be safe
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
self.c.GetAppState().CustomCommandsHistory = slices.Delete(
|
self.c.GetAppState().ShellCommandsHistory = slices.Delete(
|
||||||
self.c.GetAppState().CustomCommandsHistory, fullIndex, fullIndex+1)
|
self.c.GetAppState().ShellCommandsHistory, fullIndex, fullIndex+1)
|
||||||
self.c.SaveAppStateAndLogError()
|
self.c.SaveAppStateAndLogError()
|
||||||
self.c.Contexts().Suggestions.RefreshSuggestions()
|
self.c.Contexts().Suggestions.RefreshSuggestions()
|
||||||
return nil
|
return nil
|
||||||
|
@ -56,9 +56,9 @@ func (self *CustomCommandAction) Call() error {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *CustomCommandAction) GetCustomCommandsHistorySuggestionsFunc() func(string) []*types.Suggestion {
|
func (self *ShellCommandAction) GetShellCommandsHistorySuggestionsFunc() func(string) []*types.Suggestion {
|
||||||
return func(input string) []*types.Suggestion {
|
return func(input string) []*types.Suggestion {
|
||||||
history := self.c.GetAppState().CustomCommandsHistory
|
history := self.c.GetAppState().ShellCommandsHistory
|
||||||
|
|
||||||
return helpers.FilterFunc(history, self.c.UserConfig.Gui.UseFuzzySearch())(input)
|
return helpers.FilterFunc(history, self.c.UserConfig.Gui.UseFuzzySearch())(input)
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,6 @@ func (self *CustomCommandAction) GetCustomCommandsHistorySuggestionsFunc() func(
|
||||||
|
|
||||||
// this mimics the shell functionality `ignorespace`
|
// this mimics the shell functionality `ignorespace`
|
||||||
// which doesn't save a command to history if it starts with a space
|
// which doesn't save a command to history if it starts with a space
|
||||||
func (self *CustomCommandAction) shouldSaveCommand(command string) bool {
|
func (self *ShellCommandAction) shouldSaveCommand(command string) bool {
|
||||||
return !strings.HasPrefix(command, " ")
|
return !strings.HasPrefix(command, " ")
|
||||||
}
|
}
|
|
@ -415,9 +415,9 @@ type TranslationSet struct {
|
||||||
SquashCommitsInCurrentBranch string
|
SquashCommitsInCurrentBranch string
|
||||||
SquashCommitsAboveSelectedCommit string
|
SquashCommitsAboveSelectedCommit string
|
||||||
CannotSquashCommitsInCurrentBranch string
|
CannotSquashCommitsInCurrentBranch string
|
||||||
ExecuteCustomCommand string
|
ExecuteShellCommand string
|
||||||
ExecuteCustomCommandTooltip string
|
ExecuteShellCommandTooltip string
|
||||||
CustomCommand string
|
ShellCommand string
|
||||||
CommitChangesWithoutHook string
|
CommitChangesWithoutHook string
|
||||||
SkipHookPrefixNotConfigured string
|
SkipHookPrefixNotConfigured string
|
||||||
ResetTo string
|
ResetTo string
|
||||||
|
@ -1401,9 +1401,9 @@ func EnglishTranslationSet() *TranslationSet {
|
||||||
SquashCommitsInCurrentBranch: "In current branch",
|
SquashCommitsInCurrentBranch: "In current branch",
|
||||||
SquashCommitsAboveSelectedCommit: "Above the selected commit",
|
SquashCommitsAboveSelectedCommit: "Above the selected commit",
|
||||||
CannotSquashCommitsInCurrentBranch: "Cannot squash commits in current branch: the HEAD commit is a merge commit or is present on the main branch.",
|
CannotSquashCommitsInCurrentBranch: "Cannot squash commits in current branch: the HEAD commit is a merge commit or is present on the main branch.",
|
||||||
ExecuteCustomCommand: "Execute custom command",
|
ExecuteShellCommand: "Execute shell command",
|
||||||
ExecuteCustomCommandTooltip: "Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands.",
|
ExecuteShellCommandTooltip: "Bring up a prompt where you can enter a shell command to execute.",
|
||||||
CustomCommand: "Custom command:",
|
ShellCommand: "Shell command:",
|
||||||
CommitChangesWithoutHook: "Commit changes without pre-commit hook",
|
CommitChangesWithoutHook: "Commit changes without pre-commit hook",
|
||||||
SkipHookPrefixNotConfigured: "You have not configured a commit message prefix for skipping hooks. Set `git.skipHookPrefix = 'WIP'` in your config",
|
SkipHookPrefixNotConfigured: "You have not configured a commit message prefix for skipping hooks. Set `git.skipHookPrefix = 'WIP'` in your config",
|
||||||
ResetTo: `Reset to`,
|
ResetTo: `Reset to`,
|
||||||
|
|
|
@ -47,9 +47,9 @@ var FilterUpdatesWhenModelChanges = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
t.Views().Files().Focus()
|
t.Views().Files().Focus()
|
||||||
|
|
||||||
// To do that, we use a custom command to create a new branch that matches the filter
|
// To do that, we use a custom command to create a new branch that matches the filter
|
||||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
t.GlobalPress(keys.Universal.ExecuteShellCommand)
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
Type("git branch new-branch").
|
Type("git branch new-branch").
|
||||||
Confirm()
|
Confirm()
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,10 @@ var BasicShellCommand = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
t.Views().Files().
|
t.Views().Files().
|
||||||
IsEmpty().
|
IsEmpty().
|
||||||
IsFocused().
|
IsFocused().
|
||||||
Press(keys.Universal.ExecuteCustomCommand)
|
Press(keys.Universal.ExecuteShellCommand)
|
||||||
|
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
Type("touch file.txt").
|
Type("touch file.txt").
|
||||||
Confirm()
|
Confirm()
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,10 @@ var ComplexShellCommand = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
t.Views().Files().
|
t.Views().Files().
|
||||||
IsEmpty().
|
IsEmpty().
|
||||||
IsFocused().
|
IsFocused().
|
||||||
Press(keys.Universal.ExecuteCustomCommand)
|
Press(keys.Universal.ExecuteShellCommand)
|
||||||
|
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
Type("sh -c \"touch file.txt\"").
|
Type("sh -c \"touch file.txt\"").
|
||||||
Confirm()
|
Confirm()
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ var DeleteFromHistory = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
SetupConfig: func(cfg *config.AppConfig) {},
|
SetupConfig: func(cfg *config.AppConfig) {},
|
||||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
createCustomCommand := func(command string) {
|
createCustomCommand := func(command string) {
|
||||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
t.GlobalPress(keys.Universal.ExecuteShellCommand)
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
Type(command).
|
Type(command).
|
||||||
Confirm()
|
Confirm()
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,9 @@ var DeleteFromHistory = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
createCustomCommand("echo 2")
|
createCustomCommand("echo 2")
|
||||||
createCustomCommand("echo 3")
|
createCustomCommand("echo 3")
|
||||||
|
|
||||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
t.GlobalPress(keys.Universal.ExecuteShellCommand)
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
SuggestionLines(
|
SuggestionLines(
|
||||||
Contains("3"),
|
Contains("3"),
|
||||||
Contains("2"),
|
Contains("2"),
|
||||||
|
|
|
@ -12,15 +12,15 @@ var EditHistory = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
SetupRepo: func(shell *Shell) {},
|
SetupRepo: func(shell *Shell) {},
|
||||||
SetupConfig: func(cfg *config.AppConfig) {},
|
SetupConfig: func(cfg *config.AppConfig) {},
|
||||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
t.GlobalPress(keys.Universal.ExecuteShellCommand)
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
Type("echo x").
|
Type("echo x").
|
||||||
Confirm()
|
Confirm()
|
||||||
|
|
||||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
t.GlobalPress(keys.Universal.ExecuteShellCommand)
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
Type("ec").
|
Type("ec").
|
||||||
SuggestionLines(
|
SuggestionLines(
|
||||||
Equals("echo x"),
|
Equals("echo x"),
|
||||||
|
|
|
@ -12,22 +12,22 @@ var History = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
SetupRepo: func(shell *Shell) {},
|
SetupRepo: func(shell *Shell) {},
|
||||||
SetupConfig: func(cfg *config.AppConfig) {},
|
SetupConfig: func(cfg *config.AppConfig) {},
|
||||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
t.GlobalPress(keys.Universal.ExecuteShellCommand)
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
Type("echo 1").
|
Type("echo 1").
|
||||||
Confirm()
|
Confirm()
|
||||||
|
|
||||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
t.GlobalPress(keys.Universal.ExecuteShellCommand)
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
SuggestionLines(Contains("1")).
|
SuggestionLines(Contains("1")).
|
||||||
Type("echo 2").
|
Type("echo 2").
|
||||||
Confirm()
|
Confirm()
|
||||||
|
|
||||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
t.GlobalPress(keys.Universal.ExecuteShellCommand)
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
SuggestionLines(
|
SuggestionLines(
|
||||||
// "echo 2" was typed last, so it should come first
|
// "echo 2" was typed last, so it should come first
|
||||||
Contains("2"),
|
Contains("2"),
|
||||||
|
@ -36,9 +36,9 @@ var History = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
Type("echo 3").
|
Type("echo 3").
|
||||||
Confirm()
|
Confirm()
|
||||||
|
|
||||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
t.GlobalPress(keys.Universal.ExecuteShellCommand)
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
SuggestionLines(
|
SuggestionLines(
|
||||||
Contains("3"),
|
Contains("3"),
|
||||||
Contains("2"),
|
Contains("2"),
|
||||||
|
@ -48,9 +48,9 @@ var History = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
Confirm()
|
Confirm()
|
||||||
|
|
||||||
// Executing a command again should move it to the front:
|
// Executing a command again should move it to the front:
|
||||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
t.GlobalPress(keys.Universal.ExecuteShellCommand)
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
SuggestionLines(
|
SuggestionLines(
|
||||||
Contains("1"),
|
Contains("1"),
|
||||||
Contains("3"),
|
Contains("3"),
|
||||||
|
|
|
@ -14,23 +14,23 @@ var OmitFromHistory = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
},
|
},
|
||||||
SetupConfig: func(cfg *config.AppConfig) {},
|
SetupConfig: func(cfg *config.AppConfig) {},
|
||||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
t.GlobalPress(keys.Universal.ExecuteShellCommand)
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
Type("echo aubergine").
|
Type("echo aubergine").
|
||||||
Confirm()
|
Confirm()
|
||||||
|
|
||||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
t.GlobalPress(keys.Universal.ExecuteShellCommand)
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
SuggestionLines(Contains("aubergine")).
|
SuggestionLines(Contains("aubergine")).
|
||||||
SuggestionLines(DoesNotContain("tangerine")).
|
SuggestionLines(DoesNotContain("tangerine")).
|
||||||
Type(" echo tangerine").
|
Type(" echo tangerine").
|
||||||
Confirm()
|
Confirm()
|
||||||
|
|
||||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
t.GlobalPress(keys.Universal.ExecuteShellCommand)
|
||||||
t.ExpectPopup().Prompt().
|
t.ExpectPopup().Prompt().
|
||||||
Title(Equals("Custom command:")).
|
Title(Equals("Shell command:")).
|
||||||
SuggestionLines(Contains("aubergine")).
|
SuggestionLines(Contains("aubergine")).
|
||||||
SuggestionLines(DoesNotContain("tangerine")).
|
SuggestionLines(DoesNotContain("tangerine")).
|
||||||
Cancel()
|
Cancel()
|
||||||
|
|
|
@ -1232,7 +1232,7 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "\u003cc-d\u003e"
|
"default": "\u003cc-d\u003e"
|
||||||
},
|
},
|
||||||
"executeCustomCommand": {
|
"executeShellCommand": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": ":"
|
"default": ":"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue