2022-08-14 11:15:21 +02:00
|
|
|
package custom_commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
2022-08-14 12:13:39 +02:00
|
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
2022-08-14 11:15:21 +02:00
|
|
|
)
|
|
|
|
|
2022-08-14 12:13:39 +02:00
|
|
|
var Basic = NewIntegrationTest(NewIntegrationTestArgs{
|
2022-08-14 11:15:21 +02:00
|
|
|
Description: "Using a custom command to create a new file",
|
|
|
|
ExtraCmdArgs: "",
|
|
|
|
Skip: false,
|
2022-08-14 13:33:47 +02:00
|
|
|
SetupRepo: func(shell *Shell) {
|
|
|
|
shell.EmptyCommit("blah")
|
|
|
|
},
|
2022-08-14 11:15:21 +02:00
|
|
|
SetupConfig: func(cfg *config.AppConfig) {
|
|
|
|
cfg.UserConfig.CustomCommands = []config.CustomCommand{
|
|
|
|
{
|
|
|
|
Key: "a",
|
|
|
|
Context: "files",
|
|
|
|
Command: "touch myfile",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
2022-12-27 12:47:37 +02:00
|
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
2022-12-27 12:35:36 +02:00
|
|
|
t.Views().Files().
|
2022-12-27 13:52:20 +02:00
|
|
|
IsEmpty().
|
2022-12-27 07:27:36 +02:00
|
|
|
IsFocused().
|
|
|
|
Press("a").
|
|
|
|
Lines(
|
|
|
|
Contains("myfile"),
|
|
|
|
)
|
2022-08-14 11:15:21 +02:00
|
|
|
},
|
|
|
|
})
|