summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorAnthony HAMON <anthony.hamon@iadvize.com>2018-08-21 21:48:09 +0200
committerAnthony HAMON <anthony.hamon@iadvize.com>2018-08-26 01:58:19 +0200
commit32f4d09e895411216be3b42a66c9e3a424658acd (patch)
tree27e1538018d7c662a7a03facba7fae52f97de673 /pkg
parenta5adfaee8ab29afd7aab434a3cf0a9d7e41f8879 (diff)
move platform specific code to dedicated platform files
Diffstat (limited to 'pkg')
-rw-r--r--pkg/commands/os.go20
-rw-r--r--pkg/commands/os_default_platform.go16
-rw-r--r--pkg/commands/os_windows.go10
3 files changed, 26 insertions, 20 deletions
diff --git a/pkg/commands/os.go b/pkg/commands/os.go
index 9ccd10eb6..29ec2c654 100644
--- a/pkg/commands/os.go
+++ b/pkg/commands/os.go
@@ -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)
diff --git a/pkg/commands/os_default_platform.go b/pkg/commands/os_default_platform.go
new file mode 100644
index 000000000..f6ac1b515
--- /dev/null
+++ b/pkg/commands/os_default_platform.go
@@ -0,0 +1,16 @@
+// +build !windows
+
+package commands
+
+import (
+ "runtime"
+)
+
+func getPlatform() *Platform {
+ return &Platform{
+ os: runtime.GOOS,
+ shell: "bash",
+ shellArg: "-c",
+ escapedQuote: "\"",
+ }
+}
diff --git a/pkg/commands/os_windows.go b/pkg/commands/os_windows.go
new file mode 100644
index 000000000..28dd7a982
--- /dev/null
+++ b/pkg/commands/os_windows.go
@@ -0,0 +1,10 @@
+package commands
+
+func getPlatform() *Platform {
+ return &Platform{
+ os: "windows",
+ shell: "cmd",
+ shellArg: "/c",
+ escapedQuote: "\\\"",
+ }
+}