diff options
author | Teddy Wing | 2018-04-19 01:50:15 +0200 |
---|---|---|
committer | Teddy Wing | 2018-04-19 01:55:00 +0200 |
commit | 0613af45fd99414e97042c2fdc4a9c18b920a325 (patch) | |
tree | 82dec1ef9b7de1abfac5d779767740657f4f0cb5 | |
parent | 28786a99da12474f5bdbfd89bc1f867714b69d91 (diff) | |
download | redprine-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-x | redprine | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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 |