aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-04-19 01:50:15 +0200
committerTeddy Wing2018-04-19 01:55:00 +0200
commit0613af45fd99414e97042c2fdc4a9c18b920a325 (patch)
tree82dec1ef9b7de1abfac5d779767740657f4f0cb5
parent28786a99da12474f5bdbfd89bc1f867714b69d91 (diff)
downloadredprine-0613af45fd99414e97042c2fdc4a9c18b920a325.tar.bz2
Add a command line argument to store cache without updating issues
This is to enable open pull requests to be added to the "do not update" list in cases where you have open pull requests but have just started using Redprine and have already updated the Redmine issues of the open PRs manually.
-rwxr-xr-xredprine14
1 files changed, 14 insertions, 0 deletions
diff --git a/redprine b/redprine
index 4299878..92e8b1c 100755
--- a/redprine
+++ b/redprine
@@ -17,6 +17,8 @@ XDG_DATA_HOME=${XDG_DATA_HOME:-"${HOME}/.local/share"}
REDPRINE_DATA_DIR=${REDPRINE_DATA_DIR:-"${XDG_DATA_HOME}/redprine"}
CACHE_FILE="${REDPRINE_DATA_DIR}/${GITHUB_OWNER_REPO/\//--}.json"
+CACHE_ONLY=0
+
function print_usage () {
cat 1>&2 <<__EOF__
@@ -33,6 +35,9 @@ Flags:
--redmine-json-params=EXEC Bash-executable string that outputs JSON
as a parameter for updating issues.
Argument '\$0' is the pull request URL.
+ --cache-only Tells the program not to make update
+ requests to Redmine, just save PRs to
+ cache.
-h, --help Show this help.
-v, --version Show application version.
__EOF__
@@ -176,6 +181,12 @@ function update_cache_with_new_pull () {
}
function main () {
+ if [ "$CACHE_ONLY" -eq 1 ]; then
+ cache_my_pull_requests "$(fetch_pull_requests)"
+
+ exit
+ fi
+
local pr_json=$(new_pull_requests)
update_redmine_statuses "$pr_json"
@@ -289,6 +300,9 @@ function parse_arguments () {
shift
continue
;;
+ --cache-only)
+ CACHE_ONLY=1
+ ;;
-h | --help)
print_usage