working on lock command
This commit is contained in:
		@@ -8,33 +8,26 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// RefreshContent gets all the new file locks and updated pulls from the server (like git fetch)
 | 
			
		||||
func RefreshContent(conf *clientconfig.Gvcconfig) error {
 | 
			
		||||
	remotes := conf.Remotes
 | 
			
		||||
	for _, remote := range remotes {
 | 
			
		||||
		if remote.Default {
 | 
			
		||||
			connectionString, err := FindServer(remote.Name, conf.CurrentBranch, conf)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return err
 | 
			
		||||
			}
 | 
			
		||||
			client := resty.New()
 | 
			
		||||
			resp, err := client.R().
 | 
			
		||||
				// SetPathParams(map[string]string{
 | 
			
		||||
				// 	"repoName": repoName,
 | 
			
		||||
				// }).
 | 
			
		||||
				//Get(connectionString + "{repoName}" + "/info") //creating the full string to get info
 | 
			
		||||
				Get(connectionString + "/refresh")
 | 
			
		||||
			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("reponse not a success: %d: connection URL: %s", resp.StatusCode(), resp.Request.URL)
 | 
			
		||||
			}
 | 
			
		||||
			fmt.Println(resp)
 | 
			
		||||
			return nil
 | 
			
		||||
		}
 | 
			
		||||
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)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	client := resty.New()
 | 
			
		||||
	resp, err := client.R().
 | 
			
		||||
		SetPathParams(map[string]string{
 | 
			
		||||
			"repoName": repoName,
 | 
			
		||||
		}).
 | 
			
		||||
		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("reponse not a success: %d: connection URL: %s", resp.StatusCode(), resp.Request.URL)
 | 
			
		||||
	}
 | 
			
		||||
	fmt.Println(resp)
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user