1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-14 11:23:09 +02:00
lazygit/cmd/integration_test/main.go

59 lines
1.2 KiB
Go
Raw Normal View History

2022-08-14 06:33:44 +02:00
package main
import (
"fmt"
"log"
"os"
"github.com/jesseduffield/lazygit/pkg/integration/clients"
)
var usage = `
Usage:
See https://github.com/jesseduffield/lazygit/tree/master/pkg/integration/README.md
CLI mode:
2022-08-22 12:43:19 +02:00
> go run cmd/integration_test/main.go cli [--slow] [--sandbox] <test1> <test2> ...
2022-08-14 06:33:44 +02:00
If you pass no test names, it runs all tests
Accepted environment variables:
KEY_PRESS_DELAY (e.g. 200): the number of milliseconds to wait between keypresses
TUI mode:
> go run cmd/integration_test/main.go tui
This will open up a terminal UI where you can run tests
Help:
> go run cmd/integration_test/main.go help
`
func main() {
if len(os.Args) < 2 {
log.Fatal(usage)
}
switch os.Args[1] {
case "help":
fmt.Println(usage)
case "cli":
2022-08-14 12:47:09 +02:00
testNames := os.Args[2:]
slow := false
2022-08-22 12:43:19 +02:00
sandbox := false
2022-08-14 12:47:09 +02:00
// get the next arg if it's --slow
2022-08-22 12:43:19 +02:00
if len(os.Args) > 2 {
if os.Args[2] == "--slow" || os.Args[2] == "-slow" {
testNames = os.Args[3:]
slow = true
} else if os.Args[2] == "--sandbox" || os.Args[2] == "-sandbox" {
testNames = os.Args[3:]
sandbox = true
}
2022-08-14 12:47:09 +02:00
}
2022-08-22 12:43:19 +02:00
clients.RunCLI(testNames, slow, sandbox)
2022-08-14 06:33:44 +02:00
case "tui":
clients.RunTUI()
default:
log.Fatal(usage)
}
}