mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-10 04:07:18 +02:00
37 lines
805 B
Go
37 lines
805 B
Go
package custom_commands
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
)
|
|
|
|
var Basic = NewIntegrationTest(NewIntegrationTestArgs{
|
|
Description: "Using a custom command to create a new file",
|
|
ExtraCmdArgs: "",
|
|
Skip: false,
|
|
SetupRepo: func(shell *Shell) {
|
|
shell.EmptyCommit("blah")
|
|
},
|
|
SetupConfig: func(cfg *config.AppConfig) {
|
|
cfg.UserConfig.CustomCommands = []config.CustomCommand{
|
|
{
|
|
Key: "a",
|
|
Context: "files",
|
|
Command: "touch myfile",
|
|
},
|
|
}
|
|
},
|
|
Run: func(
|
|
shell *Shell,
|
|
input *Input,
|
|
assert *Assert,
|
|
keys config.KeybindingConfig,
|
|
) {
|
|
assert.WorkingTreeFileCount(0)
|
|
|
|
input.PressKeys("a")
|
|
assert.WorkingTreeFileCount(1)
|
|
assert.MatchSelectedLine(Contains("myfile"))
|
|
},
|
|
})
|