diff --git a/cmd/root.go b/cmd/root.go index 09cbdf9..53a37f1 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -16,7 +16,6 @@ import ( "sync/atomic" "time" - "github.com/mattn/go-isatty" "github.com/mattn/go-runewidth" "github.com/spf13/cobra" @@ -627,22 +626,6 @@ func scanProgressPathMaxLen(prefix string) int { return dynamic } -// stdinInteractiveOK reports whether stdin is suitable for blocking prompts. -// Always false under CI / known automation env vars or GIT_RAIN_NON_INTERACTIVE. -func stdinInteractiveOK() bool { - if os.Getenv("CI") != "" || os.Getenv("GITHUB_ACTIONS") != "" { - return false - } - if os.Getenv("GIT_RAIN_NON_INTERACTIVE") != "" { - return false - } - if _, err := os.Stdin.Stat(); err != nil { - return false - } - fd := os.Stdin.Fd() - return isatty.IsTerminal(fd) || isatty.IsCygwinTerminal(fd) -} - // runRainDefaultStream is the default live-run path for `git-rain` (no flags // other than scope-narrowing ones). It pipelines scan -> registry upsert -> // per-repo rain so that fetching starts as soon as the first repo is found, diff --git a/cmd/root_test.go b/cmd/root_test.go index 4ba334d..269e3cf 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -720,25 +720,6 @@ func TestScanProgressPathMaxLen(t *testing.T) { }) } -func TestStdinInteractiveOK(t *testing.T) { - t.Run("CI false", func(t *testing.T) { - t.Setenv("CI", "1") - t.Setenv("GITHUB_ACTIONS", "") - t.Setenv("GIT_RAIN_NON_INTERACTIVE", "") - if stdinInteractiveOK() { - t.Fatal("CI=1 must disable stdin interactivity") - } - }) - t.Run("GIT_RAIN_NON_INTERACTIVE false", func(t *testing.T) { - t.Setenv("CI", "") - t.Setenv("GITHUB_ACTIONS", "") - t.Setenv("GIT_RAIN_NON_INTERACTIVE", "1") - if stdinInteractiveOK() { - t.Fatal("GIT_RAIN_NON_INTERACTIVE=1 must disable stdin interactivity") - } - }) -} - func hasRainBackupBranch(t *testing.T, repoPath string) bool { t.Helper() cmd := exec.Command("git", "branch", "--format=%(refname:short)") diff --git a/go.mod b/go.mod index d834c05..d170f7f 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.10 github.com/charmbracelet/lipgloss v1.1.0 github.com/git-fire/git-testkit v0.2.0 - github.com/mattn/go-isatty v0.0.20 + github.com/gofrs/flock v0.12.1 github.com/mattn/go-runewidth v0.0.19 github.com/pelletier/go-toml/v2 v2.2.4 github.com/spf13/cobra v1.10.2 @@ -26,9 +26,9 @@ require ( github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-viper/mapstructure/v2 v2.4.0 // indirect - github.com/gofrs/flock v0.12.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/lucasb-eyer/go-colorful v1.3.0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-localereader v0.0.1 // indirect github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect diff --git a/go.sum b/go.sum index 9b4c475..9a50e76 100644 --- a/go.sum +++ b/go.sum @@ -89,17 +89,16 @@ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavM github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=