Skip to content

Commit

Permalink
Merge pull request #11 from blp1526/precondition
Browse files Browse the repository at this point in the history
Add precondition
  • Loading branch information
blp1526 authored Jul 9, 2017
2 parents 4f2c00e + 19fa501 commit cf9b3f7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ SAKURA Cloud VNC Opener for MacOS

Download a binary from [here](https://github.com/blp1526/scv/releases).

## Usage

## Precondition

1. Create a config file at `$HOME/scv.json`.
If you use this cli tool, you have to turn on a SAKURA Cloud server power.

1. Write a config file refering to [`scv.sample.json`](scv.sample.json).
## Usage

1. Run below command.
* Create a config file at `$HOME/scv.json`.
* Write a config file refering to [`scv.sample.json`](scv.sample.json).
* This file's server name don't have to match the SAKURA cloud sever name.
* Run below command.

```
# format
Expand Down
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Body struct {
Port string `json:"Port"`
}

func Request(body interface{}, zoneName string, serverName string) error {
func Request(body *Body, zoneName string, serverName string) error {
scv := &config.Scv{}
current, _ := user.Current()
dir := filepath.Join(current.HomeDir, "scv.json")
Expand Down
4 changes: 2 additions & 2 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ func Run(zoneName string, serverName string) error {
return err
}

vncPath := vncPath(*body)
vncPath := vncPath(body)
logger.Debug(fmt.Sprintf("VNC Path: %s", vncPath))
err = exec.Command("open", vncPath).Run()
return err
}

func vncPath(body api.Body) string {
func vncPath(body *api.Body) string {
return "vnc://:" + body.Password + "@" + body.Host + ":" + body.Port
}

0 comments on commit cf9b3f7

Please sign in to comment.