-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete and edit custom commands history items (#3534)
- **PR Description** Allow deleting and editing custom command history items. Deleting is done by hitting `d` on a suggestion; editing is done by hitting `e`, which fills the selected item into the command prompt for further editing. Closes #2528.
- Loading branch information
Showing
12 changed files
with
198 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
pkg/integration/tests/custom_commands/delete_from_history.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package custom_commands | ||
|
||
import ( | ||
"github.com/jesseduffield/lazygit/pkg/config" | ||
. "github.com/jesseduffield/lazygit/pkg/integration/components" | ||
) | ||
|
||
var DeleteFromHistory = NewIntegrationTest(NewIntegrationTestArgs{ | ||
Description: "Delete an entry from the custom commands history", | ||
ExtraCmdArgs: []string{}, | ||
Skip: false, | ||
SetupRepo: func(shell *Shell) {}, | ||
SetupConfig: func(cfg *config.AppConfig) {}, | ||
Run: func(t *TestDriver, keys config.KeybindingConfig) { | ||
createCustomCommand := func(command string) { | ||
t.GlobalPress(keys.Universal.ExecuteCustomCommand) | ||
t.ExpectPopup().Prompt(). | ||
Title(Equals("Custom command:")). | ||
Type(command). | ||
Confirm() | ||
} | ||
|
||
createCustomCommand("echo 1") | ||
createCustomCommand("echo 2") | ||
createCustomCommand("echo 3") | ||
|
||
t.GlobalPress(keys.Universal.ExecuteCustomCommand) | ||
t.ExpectPopup().Prompt(). | ||
Title(Equals("Custom command:")). | ||
SuggestionLines( | ||
Contains("3"), | ||
Contains("2"), | ||
Contains("1"), | ||
). | ||
DeleteSuggestion(Contains("2")). | ||
SuggestionLines( | ||
Contains("3"), | ||
Contains("1"), | ||
) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package custom_commands | ||
|
||
import ( | ||
"github.com/jesseduffield/lazygit/pkg/config" | ||
. "github.com/jesseduffield/lazygit/pkg/integration/components" | ||
) | ||
|
||
var EditHistory = NewIntegrationTest(NewIntegrationTestArgs{ | ||
Description: "Edit an entry from the custom commands history", | ||
ExtraCmdArgs: []string{}, | ||
Skip: false, | ||
SetupRepo: func(shell *Shell) {}, | ||
SetupConfig: func(cfg *config.AppConfig) {}, | ||
Run: func(t *TestDriver, keys config.KeybindingConfig) { | ||
t.GlobalPress(keys.Universal.ExecuteCustomCommand) | ||
t.ExpectPopup().Prompt(). | ||
Title(Equals("Custom command:")). | ||
Type("echo x"). | ||
Confirm() | ||
|
||
t.GlobalPress(keys.Universal.ExecuteCustomCommand) | ||
t.ExpectPopup().Prompt(). | ||
Title(Equals("Custom command:")). | ||
Type("ec"). | ||
SuggestionLines( | ||
Equals("echo x"), | ||
). | ||
EditSuggestion(Equals("echo x")). | ||
InitialText(Equals("echo x")) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters