usage() needed some minor fixes...
This commit is contained in:
parent
32494cfa0c
commit
3f7edfea67
|
@ -84,15 +84,11 @@ sub _die {
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
_warn(shift) if @_;
|
_warn(shift) if @_;
|
||||||
my ( $script, $function ) = ( caller(1) )[ 1, 3 ];
|
my $script = (caller)[1];
|
||||||
if ( not $script ) {
|
my $function = ( ( ( caller(1) )[3] ) || ( ( caller(0) )[3] ) );
|
||||||
$script = (caller)[1];
|
|
||||||
$function = 'usage';
|
|
||||||
}
|
|
||||||
dbg( "u s a g e", $script, $function );
|
|
||||||
$function =~ s/.*:://;
|
$function =~ s/.*:://;
|
||||||
my $code = slurp($script);
|
my $code = slurp($script);
|
||||||
$code =~ /^=for $function(.*?)^=cut/sm;
|
$code =~ /^=for $function\b(.*?)^=cut/sm;
|
||||||
say2( $1 ? $1 : "...no usage message in $script" );
|
say2( $1 ? $1 : "...no usage message in $script" );
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,15 +24,6 @@ Notes:
|
||||||
The 'any' ref is special -- it ignores deny rules (see docs for what this
|
The 'any' ref is special -- it ignores deny rules (see docs for what this
|
||||||
means and exceptions).
|
means and exceptions).
|
||||||
|
|
||||||
Advanced use (examples only):
|
|
||||||
|
|
||||||
gitolite list-phy-repos | gitolite access % gitweb R | grep -v DENIED | cut -f1 > ~/projects.list
|
|
||||||
# now people can stop thinking gitolite has anything to do with gitweb!
|
|
||||||
|
|
||||||
gitolite list-phy-repos | grep foo |
|
|
||||||
perl -lne 'print "$_ gitweb\n$_ daemon"' |
|
|
||||||
gitolite access % % R | grep -v DENIED | cut -f1 > insecure.repos
|
|
||||||
|
|
||||||
For each case where access is not denied, one line is printed like this:
|
For each case where access is not denied, one line is printed like this:
|
||||||
|
|
||||||
reponame<tab>username<tab>access rights
|
reponame<tab>username<tab>access rights
|
||||||
|
@ -40,6 +31,8 @@ For each case where access is not denied, one line is printed like this:
|
||||||
This is orders of magnitude faster than running the command multiple times;
|
This is orders of magnitude faster than running the command multiple times;
|
||||||
you'll notice if you have more than a hundred or so repos.
|
you'll notice if you have more than a hundred or so repos.
|
||||||
|
|
||||||
|
Advanced uses: see src/commands/post-compile/update-git-daemon-access-list for
|
||||||
|
a good example.
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
# TODO: deal with "C", call it ^C
|
# TODO: deal with "C", call it ^C
|
||||||
|
|
|
@ -12,6 +12,8 @@ Usage: gitolite help
|
||||||
Prints a list of custom commands available at this gitolite installation.
|
Prints a list of custom commands available at this gitolite installation.
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
usage() if @ARGV;
|
||||||
|
|
||||||
my $user = $ENV{GL_USER} || '';
|
my $user = $ENV{GL_USER} || '';
|
||||||
print "hello" . ( $user ? " $user" : "" ) . ", this is gitolite3 " . version() . " on git " . substr( `git --version`, 12 ) . "\n";
|
print "hello" . ( $user ? " $user" : "" ) . ", this is gitolite3 " . version() . " on git " . substr( `git --version`, 12 ) . "\n";
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ GetOptions(
|
||||||
'h' => \$help,
|
'h' => \$help,
|
||||||
) or usage();
|
) or usage();
|
||||||
|
|
||||||
usage() if @ARGV > 1;
|
usage() if @ARGV > 1 or $help;
|
||||||
$patt = shift || '.';
|
$patt = shift || '.';
|
||||||
|
|
||||||
my $user = $ENV{GL_USER} or _die "GL_USER not set";
|
my $user = $ENV{GL_USER} or _die "GL_USER not set";
|
||||||
|
|
Loading…
Reference in a new issue