'gitolite list-groups' added

This commit is contained in:
Sitaram Chamarty 2012-03-08 12:13:50 +05:30
parent b0ceac2594
commit 1be66dc10e
2 changed files with 25 additions and 0 deletions

View file

@ -6,6 +6,8 @@ package Gitolite::Conf::Load;
@EXPORT = qw(
load
access
list_groups
);
use Exporter 'import';
@ -169,5 +171,22 @@ sub data_version_mismatch {
return $data_version ne $current_data_version;
}
# ----------------------------------------------------------------------
# api functions
# ----------------------------------------------------------------------
# list all groups
sub list_groups {
die "\nUsage: gitolite list-groups\n\n(no options, no flags)\n\n" if @ARGV;
load_common();
my @g = ();
while (my ($k, $v) = each ( %groups )) {
push @g, @{ $v };
}
return (sort_u(\@g));
}
1;

View file

@ -11,6 +11,7 @@ The following subcommands are available; they should all respond to '-h':
setup 1st run: initial setup; all runs: hook fixups
compile compile gitolite.conf
query-rc get values of rc variables
list-groups list all group names in conf
=cut
# ----------------------------------------------------------------------
@ -50,5 +51,10 @@ sub args {
require Gitolite::Commands::QueryRc;
Gitolite::Commands::QueryRc->import;
query_rc();
} elsif ( $command eq 'list-groups' ) {
shift @ARGV;
require Gitolite::Conf::Load;
Gitolite::Conf::Load->import;
print "$_\n" for ( @{ list_groups() } );
}
}