diff options
author | 2015-05-11 11:37:19 +0530 | |
---|---|---|
committer | 2015-05-11 14:12:30 +0530 | |
commit | cbce2f053e75d5deb766b820c93086d6fac64a15 (patch) | |
tree | 7e34a35bb9a226974efbfa96cfc1e7455e1e1ad4 | |
parent | gitolite query-rc --dump (or -d) (diff) | |
download | gitolite-gentoo-cbce2f053e75d5deb766b820c93086d6fac64a15.tar.gz gitolite-gentoo-cbce2f053e75d5deb766b820c93086d6fac64a15.tar.bz2 gitolite-gentoo-cbce2f053e75d5deb766b820c93086d6fac64a15.zip |
change the usage() semantics slightly...
to better accommodate additional custom help messages
-rw-r--r-- | src/lib/Gitolite/Common.pm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/Gitolite/Common.pm b/src/lib/Gitolite/Common.pm index 507c5bd..266eea0 100644 --- a/src/lib/Gitolite/Common.pm +++ b/src/lib/Gitolite/Common.pm @@ -113,13 +113,13 @@ sub _die { $SIG{__DIE__} = \&_die; sub usage { - _warn(shift) if @_; my $script = (caller)[1]; - my $function = ( ( ( caller(1) )[3] ) || ( ( caller(0) )[3] ) ); + my $function = shift if @_ and $_[0] =~ /^[\w-]+$/; + $function ||= ( ( ( caller(1) )[3] ) || ( ( caller(0) )[3] ) ); $function =~ s/.*:://; my $code = slurp($script); $code =~ /^=for $function\b(.*?)^=cut/sm; - say2( $1 ? $1 : "...no usage message in $script" ); + say( $1 ? $1 : "...no usage message for '$function' in $script" ); exit 1; } |