Skip to content

Commit 8351e1c

Browse files
Joshua-AndersonJoshua Anderson
authored andcommitted
feat(client-go): add minimal windows support
1 parent c4b722d commit 8351e1c

9 files changed

Lines changed: 40 additions & 5 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ cache/image/bin/
2727
client/dist/
2828
client/makeself/
2929
client-go/deis
30+
client-go/deis.exe
3031
contrib/azure/azure-user-data
3132
contrib/bumpver/bumpver
3233
deisctl/deisctl

client-go/cmd/auth.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"net/url"
77
"strings"
8+
"syscall"
89

910
"github.com/deis/deis/client-go/controller/client"
1011
"golang.org/x/crypto/ssh/terminal"
@@ -191,7 +192,7 @@ func Regenerate(username string, all bool) error {
191192
}
192193

193194
func readPassword() (string, error) {
194-
password, err := terminal.ReadPassword(0)
195+
password, err := terminal.ReadPassword(int(syscall.Stdin))
195196

196197
return string(password), err
197198
}

client-go/cmd/keys.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package cmd
33
import (
44
"fmt"
55
"io/ioutil"
6-
"os"
76
"path"
87
"regexp"
98
"strconv"
@@ -129,7 +128,7 @@ func chooseKey() (api.KeyCreateRequest, error) {
129128
}
130129

131130
func listKeys() ([]api.KeyCreateRequest, error) {
132-
folder := path.Join(os.Getenv("HOME"), ".ssh")
131+
folder := path.Join(client.FindHome(), ".ssh")
133132
files, err := ioutil.ReadDir(folder)
134133

135134
if err != nil {

client-go/controller/client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (c Client) Save() error {
7878
return err
7979
}
8080

81-
if err = os.MkdirAll(path.Join(os.Getenv("HOME"), "/.deis/"), 0775); err != nil {
81+
if err = os.MkdirAll(path.Join(FindHome(), "/.deis/"), 0775); err != nil {
8282
return err
8383
}
8484

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// +build linux darwin
2+
3+
package client
4+
5+
import (
6+
"os"
7+
)
8+
9+
// FindHome returns the HOME directory of the current user
10+
func FindHome() string {
11+
return os.Getenv("HOME")
12+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package client
2+
3+
import (
4+
"os"
5+
)
6+
7+
// FindHome returns the HOME directory of the current user
8+
func FindHome() string {
9+
return os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
10+
}

client-go/controller/client/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func locateSettingsFile() string {
1515
filename = "client"
1616
}
1717

18-
return path.Join(os.Getenv("HOME"), ".deis", filename+".json")
18+
return path.Join(FindHome(), ".deis", filename+".json")
1919
}
2020

2121
func deleteSettings() error {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package client
2+
3+
import (
4+
"os/exec"
5+
)
6+
7+
// Webbrowser opens a URL with the default browser.
8+
func Webbrowser(u string) (err error) {
9+
_, err = exec.Command("cmd", "/c", "start", u).Output()
10+
return
11+
}

client-go/make.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
godep go build -a -installsuffix cgo -ldflags '-s' -o deis.exe .

0 commit comments

Comments
 (0)