From cc1072a8594a2b0885d7585bff2fdc66b67d5182 Mon Sep 17 00:00:00 2001 From: daveberrys <84567826+daveberrys@users.noreply.github.com> Date: Sun, 26 Jul 2026 18:31:36 +0800 Subject: [PATCH] fix shell for windows --- src/cmd/clone/root.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/cmd/clone/root.go b/src/cmd/clone/root.go index 2251da8..88f2eea 100644 --- a/src/cmd/clone/root.go +++ b/src/cmd/clone/root.go @@ -8,6 +8,7 @@ import ( "os" "os/exec" "strings" + "runtime" "github.com/daveberrys/guh/src/cmd" "github.com/daveberrys/guh/src/utils" @@ -30,7 +31,22 @@ var cloneCmd = &cobra.Command{ repoName = strings.TrimSuffix(repoName, ".git") shell := os.Getenv("SHELL") - if shell == "" { shell = "sh" } + if shell == "" { + fmt.Println("") + if runtime.GOOS != "windows" { + fmt.Println("We couldn't find your shell! Defaulting to `sh`.") + shell = "sh" + } else { + fmt.Println("Windows being windows, it doesn't export the current shell.") + fmt.Println("Defaulting to `powershell` or `cmd`.") + for _, s := range []string{"powershell", "cmd"} { + if _, err := exec.LookPath(s); err == nil { + shell = s + break + } + } + } + } fmt.Println("") fmt.Printf("Spawning in a new shell: %s\n", shell)