From 559c70227553e0433461f4a26206b72305f6a2cb Mon Sep 17 00:00:00 2001 From: Shingo Kawamura Date: Mon, 10 Jul 2017 00:51:19 +0900 Subject: [PATCH] Add doc --- README.md | 23 +++++++++++++++++++++++ api/api.go | 4 ++-- cmd/cmd.go | 3 ++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1429d8f..d68749d 100644 --- a/README.md +++ b/README.md @@ -1 +1,24 @@ # scv + +SAKURA Cloud VNC Opener for MacOS + +## Installation + +Download a binary from [here](https://github.com/blp1526/scv/releases). + +## Usage + + +1. Create a config file at `$HOME/scv.json`. + +1. Write a config file refering to [`scv.sample.json`](scv.sample.json). + +1. Run below command. + +``` +# format +$ scv ZONE_NAME SERVER_NAME + +# example +$ scv tk1a centos7 +``` diff --git a/api/api.go b/api/api.go index 2c233c2..708017b 100644 --- a/api/api.go +++ b/api/api.go @@ -36,7 +36,7 @@ func Request(body interface{}, zoneName string, serverName string) error { serverId = scv.Servers[i].ID } } - logger.Debug(fmt.Sprintf("Found ServerID is %s", serverId)) + logger.Debug(fmt.Sprintf("Server ID: %s", serverId)) if serverId == "" { return errors.New(fmt.Sprintf("ServerID is not found by ZoneName %s and ServerName %s", zoneName, serverName)) @@ -47,7 +47,7 @@ func Request(body interface{}, zoneName string, serverName string) error { host := "secure.sakura.ad.jp" path := "/cloud/zone/" + zoneName + "/api/cloud/1.1/server/" + serverId + "/vnc/proxy" url := scheme + "://" + host + path - logger.Debug("URL is " + url) + logger.Debug(fmt.Sprintf("URL: %s", url)) req, err := http.NewRequest("GET", url, nil) if err != nil { diff --git a/cmd/cmd.go b/cmd/cmd.go index b17b5ca..169198d 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -1,6 +1,7 @@ package cmd import ( + "fmt" "os/exec" "github.com/blp1526/scv/api" @@ -15,7 +16,7 @@ func Run(zoneName string, serverName string) error { } vncPath := vncPath(*body) - logger.Debug("vncPath is " + vncPath) + logger.Debug(fmt.Sprintf("VNC Path: %s", vncPath)) err = exec.Command("open", vncPath).Run() return err }