3 #=======================================================================
5 # File ID: 7364955c-334d-11e1-b42e-4302457ff287
9 # ©opyleft 2011– Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later, see end of
11 # file for legal stuff.
12 #=======================================================================
32 $progname =~ s/^.*\/(.*?)$/$1/;
33 our $VERSION = '0.00';
35 Getopt
::Long
::Configure
('bundling');
38 'debug' => \
$Opt{'debug'},
39 'help|h' => \
$Opt{'help'},
40 'verbose|v+' => \
$Opt{'verbose'},
41 'version' => \
$Opt{'version'},
43 ) || die("$progname: Option error. Use -h for help.\n");
45 $Opt{'debug'} && ($Debug = 1);
46 $Opt{'help'} && usage
(0);
47 if ($Opt{'version'}) {
52 my $rev = defined($ARGV[0]) ?
$ARGV[0] : 'HEAD';
53 print(treesize
($rev) . "\n");
59 open(PipeFP
, "git ls-tree --full-tree -l -r $commit | cut -f 1 |") or die("$progname: Cannot open git ls-tree pipe: $!");
71 # Print program version {{{
72 print("$progname v$VERSION\n");
78 # Send the help message to stdout {{{
81 if ($Opt{'verbose'}) {
87 Usage: $progname [options] [tree-ish]
94 Increase level of verbosity. Can be repeated.
96 Print version information.
98 Print debugging messages.
106 # Print a status message to stderr based on verbosity level {{{
107 my ($verbose_level, $Txt) = @_;
109 if ($Opt{'verbose'} >= $verbose_level) {
110 print(STDERR
"$progname: $Txt\n");
117 # Print a debugging message {{{
119 my @call_info = caller;
120 chomp(my $Txt = shift);
121 my $File = $call_info[1];
123 $File =~ s
#^.*/(.*?)$#$1#;
124 print(STDERR
"$File:$call_info[2] $$ $Txt\n");
131 # Plain Old Documentation (POD) {{{
141 [options] [file [files [...]]]
151 =item B<-h>, B<--help>
153 Print a brief help summary.
155 =item B<-v>, B<--verbose>
157 Increase level of verbosity. Can be repeated.
161 Print version information.
165 Print debugging messages.
175 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
179 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
180 This is free software; see the file F<COPYING> for legalese stuff.
184 This program is free software: you can redistribute it and/or modify it
185 under the terms of the GNU General Public License as published by the
186 Free Software Foundation, either version 2 of the License, or (at your
187 option) any later version.
189 This program is distributed in the hope that it will be useful, but
190 WITHOUT ANY WARRANTY; without even the implied warranty of
191 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
192 See the GNU General Public License for more details.
194 You should have received a copy of the GNU General Public License along
196 If not, see L<http://www.gnu.org/licenses/>.
204 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :