mirror of
				https://github.com/jesseduffield/lazygit.git
				synced 2025-11-03 01:13:18 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			34 lines
		
	
	
		
			752 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			752 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package custom_commands
 | 
						|
 | 
						|
import (
 | 
						|
	"github.com/jesseduffield/lazygit/pkg/config"
 | 
						|
	. "github.com/jesseduffield/lazygit/pkg/integration/components"
 | 
						|
)
 | 
						|
 | 
						|
var BasicCommand = NewIntegrationTest(NewIntegrationTestArgs{
 | 
						|
	Description:  "Using a custom command to create a new file",
 | 
						|
	ExtraCmdArgs: []string{},
 | 
						|
	Skip:         false,
 | 
						|
	SetupRepo: func(shell *Shell) {
 | 
						|
		shell.EmptyCommit("blah")
 | 
						|
	},
 | 
						|
	SetupConfig: func(cfg *config.AppConfig) {
 | 
						|
		cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
 | 
						|
			{
 | 
						|
				Key:     "a",
 | 
						|
				Context: "files",
 | 
						|
				Command: "touch myfile",
 | 
						|
			},
 | 
						|
		}
 | 
						|
	},
 | 
						|
	Run: func(t *TestDriver, keys config.KeybindingConfig) {
 | 
						|
		t.Views().Files().
 | 
						|
			IsEmpty().
 | 
						|
			IsFocused().
 | 
						|
			Press("a").
 | 
						|
			Lines(
 | 
						|
				Contains("myfile"),
 | 
						|
			)
 | 
						|
	},
 | 
						|
})
 |