gitolite/gitolite

70 lines
2 KiB
Plaintext
Raw Normal View History

#!/usr/bin/perl
# all gitolite CLI tools run as sub-commands of this command
# ----------------------------------------------------------------------
=for usage
Usage: gitolite [sub-command] [options]
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
2012-03-08 07:43:50 +01:00
list-groups list all group names in conf
list-users list all user names in conf
Warnings:
- list-users is disk bound and could take a while on sites with thousands of repos
=cut
# ----------------------------------------------------------------------
use FindBin;
BEGIN { $ENV{GL_BINDIR} = $FindBin::Bin; }
use lib $ENV{GL_BINDIR};
use Gitolite::Common;
use strict;
use warnings;
# ----------------------------------------------------------------------
args();
# ----------------------------------------------------------------------
sub args {
my ( $command, @args ) = @ARGV;
usage() if not $command or $command eq '-h';
if ( $command eq 'setup' ) {
shift @ARGV;
require Gitolite::Commands::Setup;
Gitolite::Commands::Setup->import;
setup();
} elsif ( $command eq 'compile' ) {
shift @ARGV;
_die "'gitolite compile' does not take any arguments" if @ARGV;
require Gitolite::Conf;
Gitolite::Conf->import;
compile();
} elsif ( $command eq 'query-rc' ) {
shift @ARGV;
require Gitolite::Commands::QueryRc;
Gitolite::Commands::QueryRc->import;
query_rc();
2012-03-08 07:43:50 +01:00
} elsif ( $command eq 'list-groups' ) {
shift @ARGV;
require Gitolite::Conf::Load;
Gitolite::Conf::Load->import;
print "$_\n" for ( @{ list_groups() } );
} elsif ( $command eq 'list-users' ) {
shift @ARGV;
require Gitolite::Conf::Load;
Gitolite::Conf::Load->import;
print "$_\n" for ( @{ list_users() } );
}
}