added server logging to file, added logging and formatting to info and lock commands
This commit is contained in:
		@@ -4,12 +4,14 @@ import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
 | 
			
		||||
	clientconfig "github.com/deranjer/gvc/client/clientconfig"
 | 
			
		||||
	"github.com/deranjer/gvc/common"
 | 
			
		||||
	"github.com/go-resty/resty/v2"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// RefreshContent gets all the new file locks and updated pulls from the server (like git fetch)
 | 
			
		||||
func RefreshContent(conf *clientconfig.Gvcconfig, repoName string) error { //TODO: need to change command to be able to target user specified servers
 | 
			
		||||
	connectionString, err := FindServer("", conf.CurrentBranch, conf)
 | 
			
		||||
	var refreshResult common.RepoRefreshRequest
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
@@ -18,16 +20,18 @@ func RefreshContent(conf *clientconfig.Gvcconfig, repoName string) error { //TOD
 | 
			
		||||
		SetPathParams(map[string]string{
 | 
			
		||||
			"repoName": repoName,
 | 
			
		||||
		}).
 | 
			
		||||
		Get(connectionString + "/refresh" + "{repoName}") //creating the full string to get info
 | 
			
		||||
		SetResult(&refreshResult).                         // Automatically unmarshal the JSON response to our struct
 | 
			
		||||
		Get(connectionString + "/refresh/" + "{repoName}") //creating the full string to get info
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("error connecting to server at: %s: error was: %s", connectionString, err)
 | 
			
		||||
	}
 | 
			
		||||
	if resp.IsError() {
 | 
			
		||||
		if resp.StatusCode() == 404 {
 | 
			
		||||
			return fmt.Errorf("error: repo was not found on server, 404: %s", resp.Request.URL)
 | 
			
		||||
			return fmt.Errorf("error: repo %s was not found on server, 404: %s", repoName, resp.Request.URL)
 | 
			
		||||
		}
 | 
			
		||||
		return fmt.Errorf("reponse not a success: %d: connection URL: %s", resp.StatusCode(), resp.Request.URL)
 | 
			
		||||
		return fmt.Errorf("response not a success: %d: connection URL: %s", resp.StatusCode(), resp.Request.URL)
 | 
			
		||||
	}
 | 
			
		||||
	fmt.Println(resp)
 | 
			
		||||
	fmt.Printf("%+v\n", refreshResult)
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user