diff --git a/docs/Config.md b/docs/Config.md index be579ae8bda..f0c28ff42e3 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -495,7 +495,7 @@ keybinding: scrollDownMain-alt1: J scrollUpMain-alt2: scrollDownMain-alt2: - executeCustomCommand: ':' + executeShellCommand: ':' createRebaseOptionsMenu: m # 'Files' appended for legacy reasons diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md index 47ae9cfb5d7..214b7359a6d 100644 --- a/docs/keybindings/Keybindings_en.md +++ b/docs/keybindings/Keybindings_en.md @@ -18,7 +18,7 @@ _Legend: `` means ctrl+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. | | `` } `` | 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. | -| `` : `` | 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. | | `` `` | View custom patch options | | | `` 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`. | diff --git a/docs/keybindings/Keybindings_ja.md b/docs/keybindings/Keybindings_ja.md index d72096f62cd..a433e97b6dc 100644 --- a/docs/keybindings/Keybindings_ja.md +++ b/docs/keybindings/Keybindings_ja.md @@ -18,7 +18,7 @@ _Legend: `` means ctrl+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. | | `` } `` | 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. | -| `` : `` | カスタムコマンドを実行 | 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. | | `` `` | View custom patch options | | | `` 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`. | diff --git a/docs/keybindings/Keybindings_ko.md b/docs/keybindings/Keybindings_ko.md index 7c4e9c9f458..cbafa9476e1 100644 --- a/docs/keybindings/Keybindings_ko.md +++ b/docs/keybindings/Keybindings_ko.md @@ -18,7 +18,7 @@ _Legend: `` means ctrl+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. | | `` } `` | 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. | -| `` : `` | 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. | | `` `` | 커스텀 Patch 옵션 보기 | | | `` 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`. | diff --git a/docs/keybindings/Keybindings_nl.md b/docs/keybindings/Keybindings_nl.md index 60cbf54e9b9..f63dc02600e 100644 --- a/docs/keybindings/Keybindings_nl.md +++ b/docs/keybindings/Keybindings_nl.md @@ -18,7 +18,7 @@ _Legend: `` means ctrl+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. | | `` } `` | 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. | -| `` : `` | 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. | | `` `` | Bekijk aangepaste patch opties | | | `` 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`. | diff --git a/docs/keybindings/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md index 7d2d7e5617c..952cd083703 100644 --- a/docs/keybindings/Keybindings_pl.md +++ b/docs/keybindings/Keybindings_pl.md @@ -18,7 +18,7 @@ _Legenda: `` oznacza ctrl+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. | | `` } `` | 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. | -| `` : `` | 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. | | `` `` | Wyświetl opcje niestandardowej łatki | | | `` 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`. | diff --git a/docs/keybindings/Keybindings_ru.md b/docs/keybindings/Keybindings_ru.md index ab49f2ab370..2fa0a5d2279 100644 --- a/docs/keybindings/Keybindings_ru.md +++ b/docs/keybindings/Keybindings_ru.md @@ -18,7 +18,7 @@ _Связки клавиш_ | `` ( `` | 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. | | `` { `` | Уменьшите размер контекста, отображаемого вокруг изменений в просмотрщике сравнении | 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. | | `` `` | Просмотреть пользовательские параметры патча | | | `` 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`. | diff --git a/docs/keybindings/Keybindings_zh-CN.md b/docs/keybindings/Keybindings_zh-CN.md index c91cdc8e874..cf9b146021f 100644 --- a/docs/keybindings/Keybindings_zh-CN.md +++ b/docs/keybindings/Keybindings_zh-CN.md @@ -18,7 +18,7 @@ _Legend: `` means ctrl+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. | | `` } `` | 扩大差异视图中显示的上下文范围 | 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. | -| `` : `` | 执行自定义命令 | 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. | | `` `` | 查看自定义补丁选项 | | | `` 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`. | diff --git a/docs/keybindings/Keybindings_zh-TW.md b/docs/keybindings/Keybindings_zh-TW.md index dccba00dccf..024bd25553e 100644 --- a/docs/keybindings/Keybindings_zh-TW.md +++ b/docs/keybindings/Keybindings_zh-TW.md @@ -18,7 +18,7 @@ _說明:`` 表示 Ctrl+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. | | `` } `` | 增加差異檢視中顯示變更周圍上下文的大小 | 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. | -| `` : `` | 執行自訂命令 | 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. | | `` `` | 檢視自訂補丁選項 | | | `` 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`. | diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index 19febf9a637..ef76d7274be 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -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) } + 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) if err != nil { return nil, fmt.Errorf("Couldn't migrate config file at `%s`: %s", path, err) @@ -365,8 +371,10 @@ type AppState struct { StartupPopupVersion int 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 - CustomCommandsHistory []string + // these are for shell commands typed in directly, not for custom commands in the lazygit config. + // For backwards compatibility we keep the old name in yaml files. + ShellCommandsHistory []string `yaml:"customcommandshistory"` + HideCommandLog bool IgnoreWhitespaceInDiffView bool DiffContextSize int diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index d08e4fda476..d74174376f7 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -385,7 +385,7 @@ type KeybindingUniversalConfig struct { ScrollDownMainAlt1 string `yaml:"scrollDownMain-alt1"` ScrollUpMainAlt2 string `yaml:"scrollUpMain-alt2"` ScrollDownMainAlt2 string `yaml:"scrollDownMain-alt2"` - ExecuteCustomCommand string `yaml:"executeCustomCommand"` + ExecuteShellCommand string `yaml:"executeShellCommand"` CreateRebaseOptionsMenu string `yaml:"createRebaseOptionsMenu"` Push string `yaml:"pushFiles"` // 'Files' appended for legacy reasons Pull string `yaml:"pullFiles"` // 'Files' appended for legacy reasons @@ -824,7 +824,7 @@ func GetDefaultConfig() *UserConfig { ScrollDownMainAlt1: "J", ScrollUpMainAlt2: "", ScrollDownMainAlt2: "", - ExecuteCustomCommand: ":", + ExecuteShellCommand: ":", CreateRebaseOptionsMenu: "m", Push: "P", Pull: "p", diff --git a/pkg/gui/controllers/global_controller.go b/pkg/gui/controllers/global_controller.go index 548c8461ee0..984ce3668aa 100644 --- a/pkg/gui/controllers/global_controller.go +++ b/pkg/gui/controllers/global_controller.go @@ -22,10 +22,10 @@ func NewGlobalController( func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding { return []*types.Binding{ { - Key: opts.GetKey(opts.Config.Universal.ExecuteCustomCommand), - Handler: self.customCommand, - Description: self.c.Tr.ExecuteCustomCommand, - Tooltip: self.c.Tr.ExecuteCustomCommandTooltip, + Key: opts.GetKey(opts.Config.Universal.ExecuteShellCommand), + Handler: self.shellCommand, + Description: self.c.Tr.ExecuteShellCommand, + Tooltip: self.c.Tr.ExecuteShellCommandTooltip, OpensMenu: true, }, { @@ -132,8 +132,8 @@ func (self *GlobalController) Context() types.Context { return nil } -func (self *GlobalController) customCommand() error { - return (&CustomCommandAction{c: self.c}).Call() +func (self *GlobalController) shellCommand() error { + return (&ShellCommandAction{c: self.c}).Call() } func (self *GlobalController) createCustomPatchOptionsMenu() error { diff --git a/pkg/gui/controllers/custom_command_action.go b/pkg/gui/controllers/shell_command_action.go similarity index 63% rename from pkg/gui/controllers/custom_command_action.go rename to pkg/gui/controllers/shell_command_action.go index 7b8cbc641bf..7393c188cac 100644 --- a/pkg/gui/controllers/custom_command_action.go +++ b/pkg/gui/controllers/shell_command_action.go @@ -10,19 +10,19 @@ import ( "github.com/samber/lo" ) -type CustomCommandAction struct { +type ShellCommandAction struct { c *ControllerCommon } -func (self *CustomCommandAction) Call() error { +func (self *ShellCommandAction) Call() error { return self.c.Prompt(types.PromptOpts{ - Title: self.c.Tr.CustomCommand, - FindSuggestionsFunc: self.GetCustomCommandsHistorySuggestionsFunc(), + Title: self.c.Tr.ShellCommand, + FindSuggestionsFunc: self.GetShellCommandsHistorySuggestionsFunc(), AllowEditSuggestion: true, HandleConfirm: func(command string) error { if self.shouldSaveCommand(command) { - self.c.GetAppState().CustomCommandsHistory = utils.Limit( - lo.Uniq(append([]string{command}, self.c.GetAppState().CustomCommandsHistory...)), + self.c.GetAppState().ShellCommandsHistory = utils.Limit( + lo.Uniq(append([]string{command}, self.c.GetAppState().ShellCommandsHistory...)), 1000, ) } @@ -38,17 +38,17 @@ func (self *CustomCommandAction) Call() error { // 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 // 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. 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 { // Should never happen, but better be safe return nil } - self.c.GetAppState().CustomCommandsHistory = slices.Delete( - self.c.GetAppState().CustomCommandsHistory, fullIndex, fullIndex+1) + self.c.GetAppState().ShellCommandsHistory = slices.Delete( + self.c.GetAppState().ShellCommandsHistory, fullIndex, fullIndex+1) self.c.SaveAppStateAndLogError() self.c.Contexts().Suggestions.RefreshSuggestions() 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 { - history := self.c.GetAppState().CustomCommandsHistory + history := self.c.GetAppState().ShellCommandsHistory 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` // 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, " ") } diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 296239ddecd..f2503e2e6fa 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -415,9 +415,9 @@ type TranslationSet struct { SquashCommitsInCurrentBranch string SquashCommitsAboveSelectedCommit string CannotSquashCommitsInCurrentBranch string - ExecuteCustomCommand string - ExecuteCustomCommandTooltip string - CustomCommand string + ExecuteShellCommand string + ExecuteShellCommandTooltip string + ShellCommand string CommitChangesWithoutHook string SkipHookPrefixNotConfigured string ResetTo string @@ -1401,9 +1401,9 @@ func EnglishTranslationSet() *TranslationSet { SquashCommitsInCurrentBranch: "In current branch", 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.", - ExecuteCustomCommand: "Execute custom command", - ExecuteCustomCommandTooltip: "Bring up a prompt where you can enter a shell command to execute. Not to be confused with pre-configured custom commands.", - CustomCommand: "Custom command:", + ExecuteShellCommand: "Execute shell command", + ExecuteShellCommandTooltip: "Bring up a prompt where you can enter a shell command to execute.", + ShellCommand: "Shell command:", 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", ResetTo: `Reset to`, diff --git a/pkg/integration/tests/custom_commands/basic_cmd_from_config.go b/pkg/integration/tests/custom_commands/basic_command.go similarity index 90% rename from pkg/integration/tests/custom_commands/basic_cmd_from_config.go rename to pkg/integration/tests/custom_commands/basic_command.go index 71b99c2de7b..2199745967c 100644 --- a/pkg/integration/tests/custom_commands/basic_cmd_from_config.go +++ b/pkg/integration/tests/custom_commands/basic_command.go @@ -5,7 +5,7 @@ import ( . "github.com/jesseduffield/lazygit/pkg/integration/components" ) -var BasicCmdFromConfig = NewIntegrationTest(NewIntegrationTestArgs{ +var BasicCommand = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Using a custom command to create a new file", ExtraCmdArgs: []string{}, Skip: false, diff --git a/pkg/integration/tests/filter_and_search/filter_updates_when_model_changes.go b/pkg/integration/tests/filter_and_search/filter_updates_when_model_changes.go index eb98f730e1b..1907a71594c 100644 --- a/pkg/integration/tests/filter_and_search/filter_updates_when_model_changes.go +++ b/pkg/integration/tests/filter_and_search/filter_updates_when_model_changes.go @@ -47,9 +47,9 @@ var FilterUpdatesWhenModelChanges = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files().Focus() // 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(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). Type("git branch new-branch"). Confirm() diff --git a/pkg/integration/tests/custom_commands/basic_cmd_at_runtime.go b/pkg/integration/tests/shell_commands/basic_shell_command.go similarity index 79% rename from pkg/integration/tests/custom_commands/basic_cmd_at_runtime.go rename to pkg/integration/tests/shell_commands/basic_shell_command.go index 9e1d1a185ae..e677b0672a9 100644 --- a/pkg/integration/tests/custom_commands/basic_cmd_at_runtime.go +++ b/pkg/integration/tests/shell_commands/basic_shell_command.go @@ -1,11 +1,11 @@ -package custom_commands +package shell_commands import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) -var BasicCmdAtRuntime = NewIntegrationTest(NewIntegrationTestArgs{ +var BasicShellCommand = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Using a custom command provided at runtime to create a new file", ExtraCmdArgs: []string{}, Skip: false, @@ -17,10 +17,10 @@ var BasicCmdAtRuntime = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsEmpty(). IsFocused(). - Press(keys.Universal.ExecuteCustomCommand) + Press(keys.Universal.ExecuteShellCommand) t.ExpectPopup().Prompt(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). Type("touch file.txt"). Confirm() diff --git a/pkg/integration/tests/custom_commands/complex_cmd_at_runtime.go b/pkg/integration/tests/shell_commands/complex_shell_command.go similarity index 83% rename from pkg/integration/tests/custom_commands/complex_cmd_at_runtime.go rename to pkg/integration/tests/shell_commands/complex_shell_command.go index de3c5f60fa9..a45454a4906 100644 --- a/pkg/integration/tests/custom_commands/complex_cmd_at_runtime.go +++ b/pkg/integration/tests/shell_commands/complex_shell_command.go @@ -1,11 +1,11 @@ -package custom_commands +package shell_commands import ( "github.com/jesseduffield/lazygit/pkg/config" . "github.com/jesseduffield/lazygit/pkg/integration/components" ) -var ComplexCmdAtRuntime = NewIntegrationTest(NewIntegrationTestArgs{ +var ComplexShellCommand = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Using a custom command provided at runtime to create a new file, via a shell command. We invoke custom commands through a shell already. This test proves that we can run a shell within a shell, which requires complex escaping.", ExtraCmdArgs: []string{}, Skip: false, @@ -17,10 +17,10 @@ var ComplexCmdAtRuntime = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Files(). IsEmpty(). IsFocused(). - Press(keys.Universal.ExecuteCustomCommand) + Press(keys.Universal.ExecuteShellCommand) t.ExpectPopup().Prompt(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). Type("sh -c \"touch file.txt\""). Confirm() diff --git a/pkg/integration/tests/custom_commands/delete_from_history.go b/pkg/integration/tests/shell_commands/delete_from_history.go similarity index 81% rename from pkg/integration/tests/custom_commands/delete_from_history.go rename to pkg/integration/tests/shell_commands/delete_from_history.go index e90e6c3c6ee..0c6f734553b 100644 --- a/pkg/integration/tests/custom_commands/delete_from_history.go +++ b/pkg/integration/tests/shell_commands/delete_from_history.go @@ -1,4 +1,4 @@ -package custom_commands +package shell_commands import ( "github.com/jesseduffield/lazygit/pkg/config" @@ -13,9 +13,9 @@ var DeleteFromHistory = NewIntegrationTest(NewIntegrationTestArgs{ SetupConfig: func(cfg *config.AppConfig) {}, Run: func(t *TestDriver, keys config.KeybindingConfig) { createCustomCommand := func(command string) { - t.GlobalPress(keys.Universal.ExecuteCustomCommand) + t.GlobalPress(keys.Universal.ExecuteShellCommand) t.ExpectPopup().Prompt(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). Type(command). Confirm() } @@ -24,9 +24,9 @@ var DeleteFromHistory = NewIntegrationTest(NewIntegrationTestArgs{ createCustomCommand("echo 2") createCustomCommand("echo 3") - t.GlobalPress(keys.Universal.ExecuteCustomCommand) + t.GlobalPress(keys.Universal.ExecuteShellCommand) t.ExpectPopup().Prompt(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). SuggestionLines( Contains("3"), Contains("2"), diff --git a/pkg/integration/tests/custom_commands/edit_history.go b/pkg/integration/tests/shell_commands/edit_history.go similarity index 76% rename from pkg/integration/tests/custom_commands/edit_history.go rename to pkg/integration/tests/shell_commands/edit_history.go index c6999b1f2bb..3a2195a34c3 100644 --- a/pkg/integration/tests/custom_commands/edit_history.go +++ b/pkg/integration/tests/shell_commands/edit_history.go @@ -1,4 +1,4 @@ -package custom_commands +package shell_commands import ( "github.com/jesseduffield/lazygit/pkg/config" @@ -12,15 +12,15 @@ var EditHistory = NewIntegrationTest(NewIntegrationTestArgs{ SetupRepo: func(shell *Shell) {}, SetupConfig: func(cfg *config.AppConfig) {}, Run: func(t *TestDriver, keys config.KeybindingConfig) { - t.GlobalPress(keys.Universal.ExecuteCustomCommand) + t.GlobalPress(keys.Universal.ExecuteShellCommand) t.ExpectPopup().Prompt(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). Type("echo x"). Confirm() - t.GlobalPress(keys.Universal.ExecuteCustomCommand) + t.GlobalPress(keys.Universal.ExecuteShellCommand) t.ExpectPopup().Prompt(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). Type("ec"). SuggestionLines( Equals("echo x"), diff --git a/pkg/integration/tests/custom_commands/history.go b/pkg/integration/tests/shell_commands/history.go similarity index 70% rename from pkg/integration/tests/custom_commands/history.go rename to pkg/integration/tests/shell_commands/history.go index 8348925644d..b4b638c2f0c 100644 --- a/pkg/integration/tests/custom_commands/history.go +++ b/pkg/integration/tests/shell_commands/history.go @@ -1,4 +1,4 @@ -package custom_commands +package shell_commands import ( "github.com/jesseduffield/lazygit/pkg/config" @@ -12,22 +12,22 @@ var History = NewIntegrationTest(NewIntegrationTestArgs{ SetupRepo: func(shell *Shell) {}, SetupConfig: func(cfg *config.AppConfig) {}, Run: func(t *TestDriver, keys config.KeybindingConfig) { - t.GlobalPress(keys.Universal.ExecuteCustomCommand) + t.GlobalPress(keys.Universal.ExecuteShellCommand) t.ExpectPopup().Prompt(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). Type("echo 1"). Confirm() - t.GlobalPress(keys.Universal.ExecuteCustomCommand) + t.GlobalPress(keys.Universal.ExecuteShellCommand) t.ExpectPopup().Prompt(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). SuggestionLines(Contains("1")). Type("echo 2"). Confirm() - t.GlobalPress(keys.Universal.ExecuteCustomCommand) + t.GlobalPress(keys.Universal.ExecuteShellCommand) t.ExpectPopup().Prompt(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). SuggestionLines( // "echo 2" was typed last, so it should come first Contains("2"), @@ -36,9 +36,9 @@ var History = NewIntegrationTest(NewIntegrationTestArgs{ Type("echo 3"). Confirm() - t.GlobalPress(keys.Universal.ExecuteCustomCommand) + t.GlobalPress(keys.Universal.ExecuteShellCommand) t.ExpectPopup().Prompt(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). SuggestionLines( Contains("3"), Contains("2"), @@ -48,9 +48,9 @@ var History = NewIntegrationTest(NewIntegrationTestArgs{ Confirm() // Executing a command again should move it to the front: - t.GlobalPress(keys.Universal.ExecuteCustomCommand) + t.GlobalPress(keys.Universal.ExecuteShellCommand) t.ExpectPopup().Prompt(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). SuggestionLines( Contains("1"), Contains("3"), diff --git a/pkg/integration/tests/custom_commands/omit_from_history.go b/pkg/integration/tests/shell_commands/omit_from_history.go similarity index 74% rename from pkg/integration/tests/custom_commands/omit_from_history.go rename to pkg/integration/tests/shell_commands/omit_from_history.go index 8bb26461cca..1452ece4fb8 100644 --- a/pkg/integration/tests/custom_commands/omit_from_history.go +++ b/pkg/integration/tests/shell_commands/omit_from_history.go @@ -1,4 +1,4 @@ -package custom_commands +package shell_commands import ( "github.com/jesseduffield/lazygit/pkg/config" @@ -14,23 +14,23 @@ var OmitFromHistory = NewIntegrationTest(NewIntegrationTestArgs{ }, SetupConfig: func(cfg *config.AppConfig) {}, Run: func(t *TestDriver, keys config.KeybindingConfig) { - t.GlobalPress(keys.Universal.ExecuteCustomCommand) + t.GlobalPress(keys.Universal.ExecuteShellCommand) t.ExpectPopup().Prompt(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). Type("echo aubergine"). Confirm() - t.GlobalPress(keys.Universal.ExecuteCustomCommand) + t.GlobalPress(keys.Universal.ExecuteShellCommand) t.ExpectPopup().Prompt(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). SuggestionLines(Contains("aubergine")). SuggestionLines(DoesNotContain("tangerine")). Type(" echo tangerine"). Confirm() - t.GlobalPress(keys.Universal.ExecuteCustomCommand) + t.GlobalPress(keys.Universal.ExecuteShellCommand) t.ExpectPopup().Prompt(). - Title(Equals("Custom command:")). + Title(Equals("Shell command:")). SuggestionLines(Contains("aubergine")). SuggestionLines(DoesNotContain("tangerine")). Cancel() diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 97c509d6400..c1038ee2a0a 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -21,6 +21,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/integration/tests/misc" "github.com/jesseduffield/lazygit/pkg/integration/tests/patch_building" "github.com/jesseduffield/lazygit/pkg/integration/tests/reflog" + "github.com/jesseduffield/lazygit/pkg/integration/tests/shell_commands" "github.com/jesseduffield/lazygit/pkg/integration/tests/staging" "github.com/jesseduffield/lazygit/pkg/integration/tests/stash" "github.com/jesseduffield/lazygit/pkg/integration/tests/status" @@ -115,20 +116,14 @@ var tests = []*components.IntegrationTest{ conflicts.ResolveMultipleFiles, conflicts.UndoChooseHunk, custom_commands.AccessCommitProperties, - custom_commands.BasicCmdAtRuntime, - custom_commands.BasicCmdFromConfig, + custom_commands.BasicCommand, custom_commands.CheckForConflicts, - custom_commands.ComplexCmdAtRuntime, - custom_commands.DeleteFromHistory, - custom_commands.EditHistory, custom_commands.FormPrompts, custom_commands.GlobalContext, - custom_commands.History, custom_commands.MenuFromCommand, custom_commands.MenuFromCommandsOutput, custom_commands.MultipleContexts, custom_commands.MultiplePrompts, - custom_commands.OmitFromHistory, custom_commands.ShowOutputInPanel, custom_commands.SuggestionsCommand, custom_commands.SuggestionsPreset, @@ -267,6 +262,12 @@ var tests = []*components.IntegrationTest{ reflog.DoNotShowBranchMarkersInReflogSubcommits, reflog.Patch, reflog.Reset, + shell_commands.BasicShellCommand, + shell_commands.ComplexShellCommand, + shell_commands.DeleteFromHistory, + shell_commands.EditHistory, + shell_commands.History, + shell_commands.OmitFromHistory, staging.DiffChangeScreenMode, staging.DiffContextChange, staging.DiscardAllChanges, diff --git a/schema/config.json b/schema/config.json index eb93600a33b..28318ddd60d 100644 --- a/schema/config.json +++ b/schema/config.json @@ -1232,7 +1232,7 @@ "type": "string", "default": "\u003cc-d\u003e" }, - "executeCustomCommand": { + "executeShellCommand": { "type": "string", "default": ":" },