mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-19 17:02:18 +03:00
37 lines
712 B
Go
37 lines
712 B
Go
//go:build !windows
|
|
// +build !windows
|
|
|
|
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: shell,
|
|
ShellArg: "-c",
|
|
PrefixForShellFunctionsFile: prefixForShellFunctionsFile,
|
|
OpenCommand: "open {{filename}}",
|
|
OpenLinkCommand: "open {{link}}",
|
|
}
|
|
}
|
|
|
|
func getUserShell() string {
|
|
if shell := os.Getenv("SHELL"); shell != "" {
|
|
return shell
|
|
}
|
|
|
|
return "bash"
|
|
}
|