summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-08-14 14:33:44 +1000
committerJesse Duffield <jessedduffield@gmail.com>2022-08-14 17:20:52 +1000
commit5173d7f5e17fbcab8cf2411abae1e064b076ebbb (patch)
treec5cc281b56f6b927e5408ec1961bfafd4dea8049 /cmd
parent349a7d24532a32feaaf40129b3b07b9215b8a625 (diff)
better CLI interface
Diffstat (limited to 'cmd')
-rw-r--r--cmd/integration_test/main.go49
1 files changed, 49 insertions, 0 deletions
diff --git a/cmd/integration_test/main.go b/cmd/integration_test/main.go
new file mode 100644
index 000000000..492e5e19f
--- /dev/null
+++ b/cmd/integration_test/main.go
@@ -0,0 +1,49 @@
+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:
+ > go run cmd/integration_test/main.go cli <test1> <test2> ...
+ 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
+ MODE:
+ * ask (default): if a snapshot test fails, asks if you want to update the snapshot
+ * check: if a snapshot test fails, exits with an error
+ * update: if a snapshot test fails, updates the snapshot
+ * sandbox: uses the test's setup step to run the test in a sandbox where you can do whatever you want
+
+ 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":
+ clients.RunCLI(os.Args[2:])
+ case "tui":
+ clients.RunTUI()
+ default:
+ log.Fatal(usage)
+ }
+}