Import gerrit and jira search scripts
Change-Id: I3f52a37d1b875835a521a89a1a58d7e16966483f
diff --git a/jira/jira-search/resolved.sh b/jira/jira-search/resolved.sh
new file mode 100644
index 0000000..9d2d563
--- /dev/null
+++ b/jira/jira-search/resolved.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+## --------------------------------------------------------------------
+## Intent: Retrieve a list of reason query strings
+## --------------------------------------------------------------------
+function get_jql_reasons()
+{
+ local -n ref=$1; shift
+
+ ref+=('Cannot Reproduce')
+ ref+=('Duplicate')
+ ref+=('Fixed')
+ ref+=('Incomplete')
+ ref+=("Won't Do")
+ ref+=("Won't Fix")
+ return
+}
+
+## --------------------------------------------------------------------
+## Intent: Modify search query by ticket resolution
+## --------------------------------------------------------------------
+function do_resolved()
+{
+ declare -n ans=$1; shift
+ # declare -g resolved
+
+ [[ -v resolved_start ]] && { ans+=("(Resolved >= $resolved_start)"); }
+ [[ -v resolved_end ]] && { ans+=("(Resolved <= $resolved_end)"); }
+
+ if [[ -v resolved_excl ]]; then
+ filter="$(join_by ',' "${resolved_excl[@]}")"
+ declare -p filter
+ ans+=( "(resolution NOT IN ($filter))" )
+ fi
+
+ if [[ -v resolved_incl ]]; then
+ filter="$(join_by ',' "${resolved_incl[@]}")"
+ ans+=( "(resolution IN ($filter))" )
+ fi
+
+ [[ -v resolved_not_empty ]] && { ans+=('(resolved IS NOT EMPTY)'); }
+ [[ -v resolved_is_empty ]] \
+ && { ans+=('(resolved IS EMPTY)'); } \
+ || { true; }
+
+ return
+}
+
+: # ($?=0) for source $include
+
+# [EOF]