#! /usr/bin/perl use strict; use warnings; use Getopt::Long; use Pod::Usage; use OpenSSL::Query::REST; use HTML::Entities; my %options = (); GetOptions( \%options, 'name|n', # Show name 'email|e', # Show email 'locale|l', # Show locale 'pgp|p', # Show PGP key ID 'activity|a', # Show whether person is active 'title|t=s', # Title of the resulting table 'help|?', # Help 'man', # Full manual ) or pod2usage(2); pod2usage(1) unless $options{title}; pod2usage(1) unless ($options{name} || $options{email} || $options{locale} || $options{activity} || $options{pgp}); pod2usage(1) if $options{help}; pod2usage(-exitval => 0, -verbose => 2) if $options{man}; my $query = OpenSSL::Query->new(); my %data = (); # Indexed by name, value is a hash table of vals foreach my $groupname (@ARGV) { my @members = $query->members_of($groupname); foreach my $ids (@members) { my $name = (grep m|\s|, @$ids)[0]; my $email = (grep m|\@openssl\.org$|, @$ids)[0]; my $locale = $query->find_person_tag($email, 'country'); my $pgpid = $query->find_person_tag($email, 'pgp'); $data{$name} = { email => $email, locale => $locale, pgpid => $pgpid, active => !!($groupname !~ m|-inactive$|), emeritus => !!($groupname =~ m|-emeritus$|) }; } } my @columns = (); push @columns, 'Name' if $options{name}; push @columns, 'Email' if $options{email}; push @columns, 'Locale' if $options{locale}; push @columns, 'PGP Key ID' if $options{pgp}; print "
\n", map {" | $_ | \n"} @columns); print "
---|---|
\n", map {" | $_ | \n"} @columndata); print "