From 237a31256a99e3a8658febac9ee727ef00a24012 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 11 May 2019 15:26:50 +0200 Subject: [PATCH] match multiple clan names --- getsc2clan | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/getsc2clan b/getsc2clan index 60cbc1a..498d0a3 100755 --- a/getsc2clan +++ b/getsc2clan @@ -8,9 +8,10 @@ use LWP::Authen::OAuth2; use JSON qw( decode_json ); use List::Util qw( all ); -my ($profileid, $clanmatch) = @ARGV; # clan host and name +my ($profileid, @clanmatches) = @ARGV; # clan host and names $profileid and $profileid =~ /\A\d+\z/ - or die "Usage: $0 []\n"; + or die "Usage: $0 [...]\n"; +my ($clanmatch) = map { $_ && qr/\A(?:$_)\z/i } join '|', @clanmatches; my %auth = do './.blizzard.passwd.pl' or die "no auth setup: $!\n"; my $bliz = LWP::Authen::OAuth2->new(%auth, @@ -37,7 +38,7 @@ my @ladders = ( } # activity desc grep { !$clanmatch or - all { fc $_->{clanName} eq fc $clanmatch } $_->{characters}->@* + all { $_->{clanName} =~ $clanmatch } $_->{characters}->@* } # members grep { $_->{ladder}->[0]->{division} } $ladderdata->{currentSeason}->@* -- 2.30.0