Skip to content

Commit

Permalink
fix dependencies problem
Browse files Browse the repository at this point in the history
  • Loading branch information
xzyaoi committed Sep 25, 2018
1 parent 2931dd5 commit fdfd075
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions cli/config.go
Expand Up @@ -76,6 +76,7 @@ func getDefaultConfig() cvpmConfig {

func validateConfig() {
localConfig := readConfig()
homepath, _ := homedir.Dir()
// Validate CVPM Path
cvpmPath := filepath.Join(homepath, "cvpm")
exist, err := isPathExists(cvpmPath)
Expand Down
7 changes: 5 additions & 2 deletions cli/handler.go
Expand Up @@ -7,14 +7,16 @@ import (
"github.com/mitchellh/go-homedir"
"github.com/olekukonko/tablewriter"
"github.com/urfave/cli"
"golang.org/x/crypto/ssh/terminal"
"syscall"
"log"
"os"
"path/filepath"
"strconv"
"strings"
)

func LoginHandler(c *cli.Context) {
func LoginHandler(c *cli.Context) User {
reader := bufio.NewReader(os.Stdin)
fmt.Printf("Username: ")
username, _ := reader.ReadString('\n')
Expand All @@ -23,7 +25,8 @@ func LoginHandler(c *cli.Context) {
bytePassword, _ := terminal.ReadPassword(int(syscall.Stdin))
password := strings.TrimSpace(string(bytePassword))
u := User{username, password, ""}
currentUser = u.login()
currentUser := u.login()
return currentUser
}

func InstallHandler(c *cli.Context) {
Expand Down
8 changes: 2 additions & 6 deletions cli/main.go
@@ -1,17 +1,13 @@
package main

import (
"bufio"
"fmt"
"github.com/urfave/cli"
"golang.org/x/crypto/ssh/terminal"
"log"
"os"
"strings"
"syscall"
)

func main() {
validateConfig()
// sessionToken := getCache("session-token")
var currentUser User
// if sessionToken != "" {
Expand All @@ -25,7 +21,7 @@ func main() {
{
Name: "login",
Action: func(c *cli.Context) error {
LoginHandler(c)
currentUser = LoginHandler(c)
return nil
},
},
Expand Down

0 comments on commit fdfd075

Please sign in to comment.