Use POD to generate help messages
Also, exit instead of continuing when an unrecognized option flag is seen.
This commit is contained in:
parent
87ea1d8351
commit
93561ca90a
|
@ -102,29 +102,22 @@ Written by Dan Church S<E<lt>amphetamachine@gmail.comE<gt>>
|
||||||
|
|
||||||
use File::Find qw/ find /;
|
use File::Find qw/ find /;
|
||||||
use Getopt::Std qw/ getopts /;
|
use Getopt::Std qw/ getopts /;
|
||||||
|
use Pod::Usage qw/ pod2usage /;
|
||||||
|
|
||||||
sub HELP_MESSAGE {
|
sub HELP_MESSAGE {
|
||||||
my $fh = shift;
|
my $fh = shift;
|
||||||
print $fh <<EOF
|
&pod2usage(
|
||||||
Usage: $0 [DIRS]
|
-verbose => 1,
|
||||||
Simplify a directory by hard-linking identical files.
|
-exitval => 0,
|
||||||
|
);
|
||||||
-v Verbose output.
|
|
||||||
-f Print a sum of the number of freed bytes.
|
|
||||||
-m REGEX Only match file paths matching REGEX.
|
|
||||||
-M REGEX Exclude file paths matching REGEX.
|
|
||||||
-z Include zero-length files in search.
|
|
||||||
|
|
||||||
By default, scans the current directory.
|
|
||||||
|
|
||||||
See also `perldoc $0'
|
|
||||||
EOF
|
|
||||||
;
|
|
||||||
exit 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MAIN: {
|
MAIN: {
|
||||||
&getopts('vfm:M:z', \ my %opts);
|
&getopts('vfm:M:z', \ my %opts)
|
||||||
|
|| &pod2usage(
|
||||||
|
-exitval => 2,
|
||||||
|
-msg => "Try '$0 --help' for more information",
|
||||||
|
);
|
||||||
|
|
||||||
my $verbose = defined $opts{v};
|
my $verbose = defined $opts{v};
|
||||||
my $print_freed = defined $opts{f};
|
my $print_freed = defined $opts{f};
|
||||||
|
|
Loading…
Reference in New Issue