diff options
Diffstat (limited to '.local/bin/jira-CR.php')
| -rwxr-xr-x | .local/bin/jira-CR.php | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/.local/bin/jira-CR.php b/.local/bin/jira-CR.php index bcbe873..7b62343 100755 --- a/.local/bin/jira-CR.php +++ b/.local/bin/jira-CR.php @@ -13,14 +13,19 @@ if (!function_exists('array_any')) { } } -$padlen = 50; -print(str_pad("\rGetting tickets from jira...", $padlen)); -$ticket_lines = explode("\n", rtrim(shell_exec("jira-cli issues list -q'project IS NOT EMPTY and project != AUTO and project != NET and project != MSP and project != SYST and project != LOYAL and Sprint in openSprints()' --order-by='Sprint' -s'Code Review' --columns=KEY,LABELS --plain | grep -v '^KEY\b'"))); -$tickets = array_map(fn($x) => explode("\t", $x)[0], $ticket_lines); -$ticketLabels = array_combine( - $tickets, - array_map(fn($x) => explode(',', explode("\t", $x)[1] ?? ''), $ticket_lines) -); +function get_jira(array $statuses): array { + $padlen = 50; + print(str_pad("\rGetting tickets from jira...", $padlen)); + $statuses = implode(' ', array_map(fn($x)=>"-s'$x'", $statuses)); + $ticket_lines = explode("\n", rtrim(shell_exec("jira-cli issues list -q'project IS NOT EMPTY and project != AUTO and project != NET and project != MSP and project != SYST and project != LOYAL and Sprint in openSprints()' --order-by='Sprint' $statuses --columns=KEY,LABELS --plain | grep -v '^KEY\b'"))); + $tickets = array_map(fn($x) => explode("\t", $x)[0], $ticket_lines); + $ticketLabels = array_combine( + $tickets, + array_map(fn($x) => explode(',', explode("\t", $x)[1] ?? ''), $ticket_lines) + ); + return [$tickets, $ticketLabels]; +} +[$tickets, $ticketLabels] = get_jira(['Code Review']); function get_gh(string $repo): array { |
