RT-Client-Tools/scripts/rt-helper.pl

32 lines
911 B
Perl
Raw Normal View History

# -*- Perl -*-
# Copyright © 2018, Bradley M. Kuhn
# License: AGPL-3.0-or-later
###############################################################################
sub Outreachy_FindUniqueTicket(@) {
my @searchTerms = @_;
open(my $rtLsFH, "-|", "$RT_CMD", "ls", "-i", 'Queue = outreachy-interns ' .
"AND Subject LIKE '" . $ROUND . "' AND" .
join(" AND ", @searchTerms));
my $ticketSpec;
while (my $lsLine = <$rtLsFH>) {
chomp $lsLine;
if ($lsLine =~ /ticket/) {
if (defined $ticketSpec) {
$ticketSpec = undef;
last;
}
$ticketSpec = $lsLine;
}
}
close $rtLsFH;
return $ticketSpec;
}
###############################################################################
1;
###############################################################################
#
# Local variables:
# compile-command: "perl -c rt-helper.pl"
# perl-indent-level: 2
# End: