1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-09 13:47:11 +02:00

move platform specific code to dedicated platform files

This commit is contained in:
Anthony HAMON 2018-08-21 21:48:09 +02:00
parent a5adfaee8a
commit 32f4d09e89
3 changed files with 26 additions and 20 deletions

View File

@ -4,7 +4,6 @@ import (
"errors"
"os"
"os/exec"
"runtime"
"strings"
"github.com/davecgh/go-spew/spew"
@ -74,25 +73,6 @@ func sanitisedCommandOutput(output []byte, err error) (string, error) {
return outputString, nil
}
func getPlatform() *Platform {
switch runtime.GOOS {
case "windows":
return &Platform{
os: "windows",
shell: "cmd",
shellArg: "/c",
escapedQuote: "\\\"",
}
default:
return &Platform{
os: runtime.GOOS,
shell: "bash",
shellArg: "-c",
escapedQuote: "\"",
}
}
}
// GetOpenCommand get open command
func (c *OSCommand) GetOpenCommand() (string, string, error) {
//NextStep open equivalents: xdg-open (linux), cygstart (cygwin), open (OSX)

View File

@ -0,0 +1,16 @@
// +build !windows
package commands
import (
"runtime"
)
func getPlatform() *Platform {
return &Platform{
os: runtime.GOOS,
shell: "bash",
shellArg: "-c",
escapedQuote: "\"",
}
}

View File

@ -0,0 +1,10 @@
package commands
func getPlatform() *Platform {
return &Platform{
os: "windows",
shell: "cmd",
shellArg: "/c",
escapedQuote: "\\\"",
}
}