added server logging to file, added logging and formatting to info and lock commands

This commit is contained in:
2020-06-09 23:22:07 -04:00
parent 441a9ed233
commit 161843f4c8
15 changed files with 126 additions and 66 deletions

View File

@@ -36,6 +36,10 @@ func LockFiles(input string, inputType string, conf *clientconfig.Gvcconfig) err
}
fmt.Println("Adding folder to locked: ", input)
conf.Locked.Folders = append(conf.Locked.Folders, input)
err = SendLockToServer(connectionString, conf.RepoName, "folder", input)
if err != nil {
return fmt.Errorf("error sending lock to server: %s", err)
}
return nil
case "wildcard":
var wildcard string
@@ -50,6 +54,10 @@ func LockFiles(input string, inputType string, conf *clientconfig.Gvcconfig) err
}
fmt.Println("Adding wildcard to locked: ", wildcard)
conf.Locked.Exts = append(conf.Locked.Exts, wildcard)
err = SendLockToServer(connectionString, conf.RepoName, "wildcard", input)
if err != nil {
return fmt.Errorf("error sending lock to server: %s", err)
}
return nil
}
return fmt.Errorf("This... should not have happened, some kind of internal error on LockFiles function call, switch failure")
@@ -133,7 +141,7 @@ func SendLockToServer(connectionString string, repoName string, fileType string,
if resp.StatusCode() == 404 {
return fmt.Errorf("error: repo was not found on server, 404: %s", resp.Request.URL)
}
return fmt.Errorf("response not a success: %d: connection URL: %s", resp.StatusCode(), resp.Request.URL)
return fmt.Errorf("%s: response code: %d: %s", resp.Request.URL, resp.StatusCode(), resp)
}
fmt.Println(resp)
return nil