Skip to content

Commit

Permalink
Merge pull request #16 from blp1526/open
Browse files Browse the repository at this point in the history
Remove open command
  • Loading branch information
blp1526 authored Jul 17, 2017
2 parents c852827 + 9fb0c65 commit 1cdc2d5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# scv

macOS VNC Client Opener for SAKURA Cloud
VNC path creator for SAKURA Cloud

## Installation

Expand All @@ -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
```
8 changes: 1 addition & 7 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}

Expand Down
12 changes: 8 additions & 4 deletions logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 1cdc2d5

Please sign in to comment.