42 lines
1.1 KiB
Perl
Executable file
42 lines
1.1 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
use strict;
|
|
use warnings;
|
|
|
|
use lib $ENV{GL_LIBDIR};
|
|
use Gitolite::Rc;
|
|
use Gitolite::Common;
|
|
|
|
=for usage
|
|
Usage: ssh git@host help # via ssh
|
|
gitolite help # directly on server command line
|
|
|
|
Prints a list of custom commands available at this gitolite installation.
|
|
|
|
Each command has its own help, accessed by passing it '-h' again.
|
|
=cut
|
|
|
|
usage() if @ARGV;
|
|
|
|
my $user = $ENV{GL_USER} || '';
|
|
print "hello" . ( $user ? " $user" : "" ) . ", this is gitolite3 " . version() . " on git " . substr( `git --version`, 12 ) . "\n";
|
|
|
|
print "list of " . ( $user ? "remote" : "gitolite" ) . " commands available:\n\n";
|
|
|
|
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}{$_};
|
|
}
|
|
|
|
print "\n";
|
|
|
|
exit 0;
|
|
|
|
# ------------------------------------------------------------------------------
|
|
sub list_x {
|
|
my $d = shift;
|
|
return unless $d;
|
|
_chdir "$d/commands";
|
|
return map { $_ => $d } grep { -x $_ } map { chomp; s(^./)(); $_ } `find . -type f -o -type l|sort`;
|
|
}
|