1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

Use lazycore utils: Clamp and GetLazyRootDirectory

This commit is contained in:
Gustavo Andrioli
2022-10-15 13:47:55 -03:00
parent 05089b9a9a
commit 39e84e13f4
11 changed files with 61 additions and 43 deletions

View File

@ -9,12 +9,12 @@ import (
"github.com/jesseduffield/generics/slices"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazycore/pkg/utils"
"github.com/jesseduffield/lazygit/pkg/gui"
"github.com/jesseduffield/lazygit/pkg/gui/style"
"github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests"
"github.com/jesseduffield/lazygit/pkg/secureexec"
"github.com/jesseduffield/lazygit/pkg/utils"
)
// This program lets you run integration tests from a TUI. See pkg/integration/README.md for more info.
@ -22,7 +22,7 @@ import (
var SLOW_KEY_PRESS_DELAY = 300
func RunTUI() {
rootDir := utils.GetLazygitRootDirectory()
rootDir := utils.GetLazyRootDirectory()
testDir := filepath.Join(rootDir, "test", "integration")
app := newApp(testDir)

View File

@ -7,8 +7,8 @@ import (
"os/exec"
"path/filepath"
"github.com/jesseduffield/lazycore/pkg/utils"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/utils"
)
// this is the integration runner for the new and improved integration interface
@ -44,7 +44,7 @@ func RunTests(
keyPressDelay int,
maxAttempts int,
) error {
projectRootDir := utils.GetLazygitRootDirectory()
projectRootDir := utils.GetLazyRootDirectory()
err := os.Chdir(projectRootDir)
if err != nil {
return err

View File

@ -8,6 +8,7 @@ import (
"github.com/jesseduffield/generics/set"
"github.com/jesseduffield/generics/slices"
"github.com/jesseduffield/lazycore/pkg/utils"
"github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/bisect"
"github.com/jesseduffield/lazygit/pkg/integration/tests/branch"
@ -15,7 +16,6 @@ import (
"github.com/jesseduffield/lazygit/pkg/integration/tests/commit"
"github.com/jesseduffield/lazygit/pkg/integration/tests/custom_commands"
"github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase"
"github.com/jesseduffield/lazygit/pkg/utils"
)
// Here is where we lists the actual tests that will run. When you create a new test,
@ -53,7 +53,7 @@ func GetTests() []*components.IntegrationTest {
missingTestNames := []string{}
if err := filepath.Walk(filepath.Join(utils.GetLazygitRootDirectory(), "pkg/integration/tests"), func(path string, info os.FileInfo, err error) error {
if err := filepath.Walk(filepath.Join(utils.GetLazyRootDirectory(), "pkg/integration/tests"), func(path string, info os.FileInfo, err error) error {
if !info.IsDir() && strings.HasSuffix(path, ".go") {
// ignoring this current file
if filepath.Base(path) == "tests.go" {