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