1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Add config os.shellFunctionsFile

This commit is contained in:
Stefan Haller
2025-03-09 18:15:48 +01:00
parent 41e9335ea8
commit dc48cf963a
10 changed files with 75 additions and 24 deletions

View File

@ -4,15 +4,33 @@
package oscommands
import (
"os"
"runtime"
"strings"
)
func GetPlatform() *Platform {
shell := getUserShell()
prefixForShellFunctionsFile := ""
if strings.HasSuffix(shell, "bash") {
prefixForShellFunctionsFile = "shopt -s expand_aliases\n"
}
return &Platform{
OS: runtime.GOOS,
Shell: "bash",
ShellArg: "-c",
OpenCommand: "open {{filename}}",
OpenLinkCommand: "open {{link}}",
OS: runtime.GOOS,
Shell: shell,
ShellArg: "-c",
PrefixForShellFunctionsFile: prefixForShellFunctionsFile,
OpenCommand: "open {{filename}}",
OpenLinkCommand: "open {{link}}",
}
}
func getUserShell() string {
if shell := os.Getenv("SHELL"); shell != "" {
return shell
}
return "bash"
}