--- trunk/sender.pl 2005/05/14 13:12:00 8 +++ trunk/sender.pl 2005/05/14 13:21:35 9 @@ -12,7 +12,7 @@ =head1 SYNOPSYS sender.pl --add=mylist members.txt - sender.pl --list + sender.pl --list[=mylist] sender.pl --queue=mylist message.txt sender.pl --send=mylist @@ -31,7 +31,7 @@ my $queue_opt; my $result = GetOptions( - "list" => \$list_opt, + "list:s" => \$list_opt, "add=s" => \$add_opt, "queue=s" => \$queue_opt, "debug" => \$debug, @@ -55,14 +55,22 @@ my $messages = $loader->find_class('messages'); my $message_list = $loader->find_class('message_list'); -=item --list +=item --list[=list_name] -List all available lists and users on them +List all available lists and users on them. Optional value to list +(like C<--list=list_name>) will produce users just on that list. =cut -if ($list_opt) { - foreach my $list ($lists->retrieve_all) { +if (defined($list_opt)) { + my @lists; + if ($list_opt ne '') { + @lists = $lists->search( name=> $list_opt )->first || die "can't find list $list_opt"; + } else { + @lists = $lists->retrieve_all; + } + + foreach my $list (@lists) { print $list->name,"\n"; foreach my $user_on_list ($user_list->search(list_id => $list->id)) { my $user = $users->retrieve( id => $user_on_list->user_id );