2012-03-16 04:55:39 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
2012-04-06 16:59:05 +02:00
|
|
|
use lib $ENV{GL_LIBDIR};
|
2012-03-16 04:55:39 +01:00
|
|
|
use Gitolite::Rc;
|
|
|
|
use Gitolite::Common;
|
|
|
|
|
|
|
|
=for usage
|
2012-03-20 12:22:38 +01:00
|
|
|
Usage: ssh git@host help # via ssh
|
|
|
|
gitolite help # directly on server command line
|
2012-03-16 04:55:39 +01:00
|
|
|
|
|
|
|
Prints a list of custom commands available at this gitolite installation.
|
2012-03-20 12:22:38 +01:00
|
|
|
|
|
|
|
Each command has its own help, accessed by passing it '-h' again.
|
2012-03-16 04:55:39 +01:00
|
|
|
=cut
|
|
|
|
|
2012-03-19 17:04:07 +01:00
|
|
|
usage() if @ARGV;
|
|
|
|
|
2012-03-16 04:55:39 +01:00
|
|
|
my $user = $ENV{GL_USER} || '';
|
2012-03-17 03:10:17 +01:00
|
|
|
print "hello" . ( $user ? " $user" : "" ) . ", this is gitolite3 " . version() . " on git " . substr( `git --version`, 12 ) . "\n";
|
2012-03-16 04:55:39 +01:00
|
|
|
|
2012-03-17 03:10:17 +01:00
|
|
|
print "list of " . ( $user ? "remote" : "gitolite" ) . " commands available:\n\n";
|
2012-03-16 04:55:39 +01:00
|
|
|
|
2012-06-19 17:30:53 +02:00
|
|
|
my %list = (list_x( $ENV{GL_BINDIR}), list_x($rc{LOCAL_CODE} || ''));
|
|
|
|
for (sort keys %list) {
|
|
|
|
print "\t$list{$_}" if $ENV{D};
|
|
|
|
print "\t$_\n" if not $user or $rc{COMMANDS}{$_};
|
2012-03-16 04:55:39 +01:00
|
|
|
}
|
2012-06-19 17:30:53 +02:00
|
|
|
|
2012-03-16 04:55:39 +01:00
|
|
|
print "\n";
|
|
|
|
|
|
|
|
exit 0;
|
2012-06-19 17:30:53 +02:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
sub list_x {
|
|
|
|
my $d = shift;
|
|
|
|
return unless $d;
|
2012-08-30 15:10:24 +02:00
|
|
|
return unless -d "$d/commands";
|
2012-06-19 17:30:53 +02:00
|
|
|
_chdir "$d/commands";
|
2012-08-03 22:46:43 +02:00
|
|
|
return map { $_ => $d } grep { -x $_ } map { chomp; s(^./)(); $_ } `find . -type f -o -type l|sort`;
|
2012-06-19 17:30:53 +02:00
|
|
|
}
|