From 0613af45fd99414e97042c2fdc4a9c18b920a325 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 19 Apr 2018 01:50:15 +0200 Subject: 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. --- redprine | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 -- cgit v1.2.3