'gitolite list-members' added
This commit is contained in:
parent
c9826eee07
commit
00934c8304
|
@ -11,6 +11,7 @@ package Gitolite::Conf::Load;
|
|||
list_users
|
||||
list_repos
|
||||
list_memberships
|
||||
list_members
|
||||
);
|
||||
|
||||
use Exporter 'import';
|
||||
|
@ -260,6 +261,30 @@ Usage: gitolite list-memberships <name>
|
|||
return (sort_u(\@m));
|
||||
}
|
||||
|
||||
sub list_members {
|
||||
|
||||
die "
|
||||
Usage: gitolite list-members <group name>
|
||||
|
||||
- list all members of a group
|
||||
- takes one group name
|
||||
|
||||
" if @ARGV and $ARGV[0] eq '-h' or not @ARGV and not @_;
|
||||
|
||||
my $name = ( @_ ? shift @_ : shift @ARGV );
|
||||
|
||||
load_common();
|
||||
|
||||
my @m = ();
|
||||
while (my ($k, $v) = each ( %groups )) {
|
||||
for my $g ( @{ $v } ) {
|
||||
push @m, $k if $g eq $name;
|
||||
}
|
||||
}
|
||||
|
||||
return (sort_u(\@m));
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
{
|
||||
|
|
6
gitolite
6
gitolite
|
@ -15,6 +15,7 @@ The following subcommands are available; they should all respond to '-h':
|
|||
list-users list all users/user groups in conf
|
||||
list-repos list all repos/repo groups in conf
|
||||
list-memberships list all groups a name is a member of
|
||||
list-members list all members of a group
|
||||
|
||||
Warnings:
|
||||
- list-users is disk bound and could take a while on sites with 1000s of repos
|
||||
|
@ -79,5 +80,10 @@ sub args {
|
|||
require Gitolite::Conf::Load;
|
||||
Gitolite::Conf::Load->import;
|
||||
print "$_\n" for ( @{ list_memberships() } );
|
||||
} elsif ( $command eq 'list-members' ) {
|
||||
shift @ARGV;
|
||||
require Gitolite::Conf::Load;
|
||||
Gitolite::Conf::Load->import;
|
||||
print "$_\n" for ( @{ list_members() } );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue