From 1be66dc10e0fe2130fbc8cfb6ddd19c1c20b84e5 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Thu, 8 Mar 2012 12:13:50 +0530 Subject: [PATCH] 'gitolite list-groups' added --- Gitolite/Conf/Load.pm | 19 +++++++++++++++++++ gitolite | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/Gitolite/Conf/Load.pm b/Gitolite/Conf/Load.pm index af62812..34b6a1e 100644 --- a/Gitolite/Conf/Load.pm +++ b/Gitolite/Conf/Load.pm @@ -6,6 +6,8 @@ package Gitolite::Conf::Load; @EXPORT = qw( load access + + list_groups ); use Exporter 'import'; @@ -169,5 +171,22 @@ sub data_version_mismatch { return $data_version ne $current_data_version; } +# ---------------------------------------------------------------------- +# api functions +# ---------------------------------------------------------------------- + +# list all groups +sub list_groups { + die "\nUsage: gitolite list-groups\n\n(no options, no flags)\n\n" if @ARGV; + + load_common(); + + my @g = (); + while (my ($k, $v) = each ( %groups )) { + push @g, @{ $v }; + } + return (sort_u(\@g)); +} + 1; diff --git a/gitolite b/gitolite index f89f12f..43868a5 100755 --- a/gitolite +++ b/gitolite @@ -11,6 +11,7 @@ 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 + list-groups list all group names in conf =cut # ---------------------------------------------------------------------- @@ -50,5 +51,10 @@ sub args { require Gitolite::Commands::QueryRc; Gitolite::Commands::QueryRc->import; query_rc(); + } elsif ( $command eq 'list-groups' ) { + shift @ARGV; + require Gitolite::Conf::Load; + Gitolite::Conf::Load->import; + print "$_\n" for ( @{ list_groups() } ); } }