Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
xzyaoi committed Sep 19, 2018
1 parent e28a6bd commit c03821f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cli/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func writeConfig(config cvpmConfig) {
func getDefaultConfig() cvpmConfig {
localPath, _ := homedir.Dir()
cvpmPath := filepath.Join(localPath, "cvpm")
var defaultLocal = local{LocalFolder:cvpmPath, Pip:"pip", Python:"python"}
var defaultLocal = local{LocalFolder: cvpmPath, Pip: "pip", Python: "python"}
var defaultCVPMConfig = cvpmConfig{Local: defaultLocal, Repositories: []Repository{}}
return defaultCVPMConfig
}
14 changes: 7 additions & 7 deletions cli/handler.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package main

import (
"bufio"
"fmt"
"github.com/fatih/color"
"github.com/mitchellh/go-homedir"
"github.com/olekukonko/tablewriter"
"github.com/urfave/cli"
"github.com/mitchellh/go-homedir"
"fmt"
"log"
"os"
"path/filepath"
"strconv"
"strings"
"bufio"
"path/filepath"
"log"
)

func InstallHandler(c *cli.Context) {
Expand Down Expand Up @@ -87,7 +87,7 @@ func RepoHandler(c *cli.Context) {
}
}

func ConfigHandler(c* cli.Context) {
func ConfigHandler(c *cli.Context) {
homepath, _ := homedir.Dir()
configFilePath := filepath.Join(homepath, "cvpm", "config.toml")
if _, err := os.Stat(configFilePath); os.IsNotExist(err) {
Expand Down Expand Up @@ -118,7 +118,7 @@ func ConfigHandler(c* cli.Context) {
nextConfig.Local.Python = newPyLocation
// Handle Pypi Location
fmt.Printf("Pip Location[" + prevConfig.Local.Pip + "]")
newPipLocation, _:= reader.ReadString('\n')
newPipLocation, _ := reader.ReadString('\n')
newPipLocation = strings.TrimSpace(newPipLocation)
if newPipLocation == "y" || newPipLocation == "Y" || newPipLocation == "Yes" || newPipLocation == "" {
newPipLocation = prevConfig.Local.Pip
Expand Down
10 changes: 5 additions & 5 deletions cli/query.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package main

import (
"github.com/mitchellh/go-homedir"
"github.com/levigross/grequests"
"os/user"
"github.com/mitchellh/go-homedir"
"log"
"os/user"
)

func ClientPost(endpoint string, params map[string]string) {
Expand All @@ -15,8 +15,8 @@ func ClientPost(endpoint string, params map[string]string) {
}
resp, err := grequests.Post(url, &grequests.RequestOptions{
Headers: map[string]string{"X-Current-User": currentUser.Username},
JSON: params,
IsAjax: true,
JSON: params,
IsAjax: true,
})
if err != nil {
log.Fatal(err)
Expand All @@ -34,7 +34,7 @@ func ClientGet(endpoint string, params map[string]string) {
}
resp, err := grequests.Get(url, &grequests.RequestOptions{
Headers: map[string]string{"X-Current-Homedir": myhomedir},
Params: params,
Params: params,
})
if err != nil {
log.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion cli/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func readRepos() []Repository {
return repos
}

func readClientRepos (currentHomedir string) []Repository {
func readClientRepos(currentHomedir string) []Repository {
configs := readClientConfig(currentHomedir)
repos := configs.Repositories
return repos
Expand Down
6 changes: 3 additions & 3 deletions cli/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"github.com/kardianos/service"
"log"
"os/user"
"os"
"os/user"
"runtime"
)

Expand All @@ -24,7 +24,7 @@ func getCVPMDConfig() *service.Config {
currentUser, _ := user.Current()
var realUsername string
if currentUser.Username == "root" && runtime.GOOS != "windows" {
realUsername = os.Getenv("SUDO_USER")
realUsername = os.Getenv("SUDO_USER")
} else {
realUsername = currentUser.Username
}
Expand All @@ -33,7 +33,7 @@ func getCVPMDConfig() *service.Config {
DisplayName: "CVPM Daemon",
Description: "Computer Vision Package Manager[Daemon]",
Arguments: []string{"daemon", "run"},
UserName: realUsername,
UserName: realUsername,
}
return srvConf
}
Expand Down

0 comments on commit c03821f

Please sign in to comment.