aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-04-18 22:15:05 +0200
committerTeddy Wing2018-04-18 22:15:05 +0200
commitccedafb019f7287010f89742d42ac46afe1fdb52 (patch)
tree5878287bfae9bb2b480b3b7c8b5249324983a085
parent7a26da37d273d7f25bbb06f86936dfd89adabcdc (diff)
downloadredprine-ccedafb019f7287010f89742d42ac46afe1fdb52.tar.bz2
Get rid of the `$NEW_PRS` variable
Looking over the code again it dawned on me that this variable is unnecessary and overcomplicates the code. Just pass in the result from before as an argument to the function.
-rwxr-xr-xredprine9
1 files changed, 4 insertions, 5 deletions
diff --git a/redprine b/redprine
index 2b93085..fd21649 100755
--- a/redprine
+++ b/redprine
@@ -13,8 +13,6 @@ REDMINE_TOKEN=''
CACHE_FILE="$HOME/redprine.json"
-NEW_PRS=''
-
function github_owner_repo () {
local git_remote=$(git remote get-url origin)
local owner_repo=$(echo "$git_remote" |
@@ -193,7 +191,9 @@ function update_redmine_status () {
}
function update_cache_with_new_pulls () {
- jq "${NEW_PRS} + ." "$CACHE_FILE" > "${CACHE_FILE}.new"
+ local new_pull_requests="$1"
+
+ jq "$new_pull_requests" "$CACHE_FILE" > "${CACHE_FILE}.new"
mv "${CACHE_FILE}.new" "$CACHE_FILE"
}
@@ -202,8 +202,7 @@ function update_cache_with_new_pulls () {
# pull_requests=$(fetch_pull_requests)
# cache_my_pull_requests "$pull_requests"
pr_json=$(new_pull_requests)
-NEW_PRS="$pr_json"
issue_prs=$(issue_numbers_and_pull_request_urls "$pr_json")
update_redmine_statuses "$issue_prs"
-update_cache_with_new_pulls
+update_cache_with_new_pulls "$pr_json"