Joey Armstrong | 3134bfd | 2024-02-10 20:51:25 -0500 | [diff] [blame] | 1 | #!/bin/bash |
Joey Armstrong | 6890fa9 | 2024-08-15 12:14:37 -0400 | [diff] [blame^] | 2 | ## ----------------------------------------------------------------------- |
| 3 | ## ----------------------------------------------------------------------- |
| 4 | |
| 5 | [[ ! -v JCL_resovled ]] && { declare -g -a JCL_resolved=(); } |
| 6 | |
| 7 | ## -------------------------------------------------------------------- |
| 8 | ## Intent: Retrieve a list of reason query strings |
| 9 | ## -------------------------------------------------------------------- |
| 10 | function get_jcl_resolved() |
| 11 | { |
| 12 | local -n ref=$1; shift |
| 13 | |
| 14 | local -a tmp=() |
| 15 | do_resolved tmp |
| 16 | ref+=("$tmp") |
| 17 | |
| 18 | local query="$(join_by 'OR' "${tmp[0]}")" |
| 19 | ref+=("($query)") |
| 20 | |
| 21 | return |
| 22 | } |
Joey Armstrong | 3134bfd | 2024-02-10 20:51:25 -0500 | [diff] [blame] | 23 | |
| 24 | ## -------------------------------------------------------------------- |
| 25 | ## Intent: Retrieve a list of reason query strings |
| 26 | ## -------------------------------------------------------------------- |
| 27 | function get_jql_reasons() |
| 28 | { |
| 29 | local -n ref=$1; shift |
| 30 | |
| 31 | ref+=('Cannot Reproduce') |
| 32 | ref+=('Duplicate') |
| 33 | ref+=('Fixed') |
| 34 | ref+=('Incomplete') |
| 35 | ref+=("Won't Do") |
| 36 | ref+=("Won't Fix") |
| 37 | return |
| 38 | } |
| 39 | |
| 40 | ## -------------------------------------------------------------------- |
| 41 | ## Intent: Modify search query by ticket resolution |
| 42 | ## -------------------------------------------------------------------- |
| 43 | function do_resolved() |
| 44 | { |
| 45 | declare -n ans=$1; shift |
Joey Armstrong | 3134bfd | 2024-02-10 20:51:25 -0500 | [diff] [blame] | 46 | |
| 47 | [[ -v resolved_start ]] && { ans+=("(Resolved >= $resolved_start)"); } |
| 48 | [[ -v resolved_end ]] && { ans+=("(Resolved <= $resolved_end)"); } |
| 49 | |
| 50 | if [[ -v resolved_excl ]]; then |
| 51 | filter="$(join_by ',' "${resolved_excl[@]}")" |
| 52 | declare -p filter |
| 53 | ans+=( "(resolution NOT IN ($filter))" ) |
| 54 | fi |
| 55 | |
| 56 | if [[ -v resolved_incl ]]; then |
| 57 | filter="$(join_by ',' "${resolved_incl[@]}")" |
| 58 | ans+=( "(resolution IN ($filter))" ) |
| 59 | fi |
| 60 | |
Joey Armstrong | 6890fa9 | 2024-08-15 12:14:37 -0400 | [diff] [blame^] | 61 | [[ -v resolved_not_empty ]] \ |
| 62 | && { ans+=('(resolved IS NOT EMPTY)'); } \ |
| 63 | || { true; } |
| 64 | |
Joey Armstrong | 3134bfd | 2024-02-10 20:51:25 -0500 | [diff] [blame] | 65 | [[ -v resolved_is_empty ]] \ |
| 66 | && { ans+=('(resolved IS EMPTY)'); } \ |
| 67 | || { true; } |
| 68 | |
| 69 | return |
| 70 | } |
| 71 | |
| 72 | : # ($?=0) for source $include |
| 73 | |
| 74 | # [EOF] |