From 9fb0c65e255e1b57cba9ae90aa1198a23d937605 Mon Sep 17 00:00:00 2001 From: Shingo Kawamura Date: Mon, 17 Jul 2017 23:44:59 +0900 Subject: [PATCH] Remove open command --- README.md | 6 +++--- cmd/cmd.go | 8 +------- logger/logger.go | 12 ++++++++---- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index fb301d5..207ef58 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # scv -macOS VNC Client Opener for SAKURA Cloud +VNC path creator for SAKURA Cloud ## Installation @@ -18,9 +18,9 @@ If you use this cli tool, you have to turn on a SAKURA Cloud server power. * Run below command. ``` -# format +# Format $ scv ZONE_NAME SERVER_NAME -# example +# Example $ scv tk1a centos7 ``` diff --git a/cmd/cmd.go b/cmd/cmd.go index de4a58d..5d7a7fa 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -2,10 +2,8 @@ package cmd import ( "fmt" - "os/exec" "github.com/blp1526/scv/api" - "github.com/blp1526/scv/logger" ) const version = "0.0.1" @@ -29,11 +27,7 @@ func Run(args ...string) (msg string, err error) { return msg, err } - vncPath := vncPath(body) - logger.Debug(fmt.Sprintf("VNC Path: %s", vncPath)) - command := "open" - msg = fmt.Sprintf("%s %s", command, vncPath) - err = exec.Command(command, vncPath).Run() + msg = vncPath(body) return msg, err } diff --git a/logger/logger.go b/logger/logger.go index e77a61c..2f817c4 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -14,10 +14,14 @@ const magenta = "\033[35m" const cyan = "\033[36m" const lightGray = "\033[37m" -func Debug(message string) { - fmt.Printf("%sdebug%s: %s\n", lightGray, normal, message) +func Debug(msg string) { + fmt.Println(format(lightGray, "debug", msg)) } -func Fatal(message string) { - fmt.Printf("%sfatal%s: %s\n", red, normal, message) +func Fatal(msg string) { + fmt.Println(format(red, "fatal", msg)) +} + +func format(color string, level string, msg string) string { + return fmt.Sprintf("%s%s%s: %s", color, level, normal, msg) }