gitolite/src/commands/info
Sitaram Chamarty 8714b77eae (perltidy)
2012-03-24 10:30:43 +05:30

44 lines
932 B
Perl
Executable file

#!/usr/bin/perl
use strict;
use warnings;
use lib $ENV{GL_BINDIR};
use Gitolite::Rc;
use Gitolite::Common;
use Gitolite::Conf::Load;
=for usage
Usage: gitolite info
- list all repos/repo groups you can access
- no options, no flags
=cut
usage() if @ARGV;
my $user = $ENV{GL_USER} or _die "GL_USER not set";
my $ref = 'any';
print "hello $user, this is gitolite3 " . version() . " on git " . substr( `git --version`, 12 ) . "\n";
my $lr = lister_dispatch('list-repos');
my $lm = lister_dispatch('list-members');
for ( @{ $lr->() } ) {
my $perm = '';
for my $aa (qw(R W ^C)) {
my $ret = access( $_, $user, $aa, $ref );
$perm .= ( $ret =~ /DENIED/ ? " " : " $aa" );
}
next unless $perm =~ /\S/;
if (/^\@/) {
print "\n$perm\t$_\n";
for ( @{ $lm->($_) } ) {
print "$perm\t$_\n";
}
print "\n";
} else {
print "$perm\t$_\n";
}
}