summaryrefslogtreecommitdiff
path: root/src/commands/info
diff options
context:
space:
mode:
authorSitaram Chamarty <sitaram@atc.tcs.com>2012-03-12 20:54:30 +0530
committerSitaram Chamarty <sitaram@atc.tcs.com>2012-03-24 10:30:42 +0530
commit7f8020adc5709690e74f0d07838022e43533c272 (patch)
tree233f1050e326e63c19dbbc398315d87721fcf13b /src/commands/info
parent0aeb0cd5e2e37387a7fff5e11ff3012eb5b65646 (diff)
'info' command, plus lots more changes:
- usage() gets a little smarter; it now knows what function it was called from and tries to find a '=for function_name' chunk of data in the script - the various list-* functions now work off a dispatcher in Load.pm - (...and they all use the new usage() magic to print their helps!) - src/gitolite got a lot leaner due to this dispatcher - src/gitolite-shell became a lot more easier to read/flow - rc acquired '{COMMANDS}', which gitolite-shell now refers to - comments in the default rc file changed a bit - rc got a new REMOTE_COMMAND_PATT (in place of ADC_CMD_ARGS_PATT) the rest is perltidy and stuff like that
Diffstat (limited to 'src/commands/info')
-rwxr-xr-xsrc/commands/info31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/commands/info b/src/commands/info
new file mode 100755
index 0000000..fe52837
--- /dev/null
+++ b/src/commands/info
@@ -0,0 +1,31 @@
+#!/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';
+
+my $fn = lister_dispatch('list-repos');
+
+for ( @{ $fn->() } ) {
+ my $perm = '';
+ for my $aa (qw(R W ^C)) {
+ my $ret = access($_, $user, $aa, $ref);
+ $perm .= ( $ret =~ /DENIED/ ? " " : " $aa" );
+ }
+ print "$perm\t$_\n" if $perm =~ /\S/;
+}