add --man option and reduce output of --help option
Printing the full man page requires the perl-doc package. To avoid this dependency, print the less verbose output containing only the synopsis and the option list for the --help option and print the full output (requiring perldoc) for the --man option.
This commit is contained in:
parent
de8b6a457d
commit
aad36777e8
2 changed files with 25 additions and 4 deletions
17
coverage.sh
17
coverage.sh
|
@ -52,7 +52,7 @@ if [ ! -e shared/mmdebstrap ] || [ mmdebstrap -nt shared/mmdebstrap ]; then
|
|||
fi
|
||||
|
||||
starttime=
|
||||
total=109
|
||||
total=110
|
||||
i=1
|
||||
|
||||
print_header() {
|
||||
|
@ -233,7 +233,20 @@ cat << END > shared/test.sh
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
export LC_ALL=C.UTF-8
|
||||
$CMD --help | grep --quiet SYNOPSIS
|
||||
$CMD --help | grep --quiet --fixed-strings 'mmdebstrap [OPTION...] [SUITE [TARGET [MIRROR...]]]'
|
||||
END
|
||||
if [ "$HAVE_QEMU" = "yes" ]; then
|
||||
./run_qemu.sh
|
||||
else
|
||||
./run_null.sh SUDO
|
||||
fi
|
||||
|
||||
print_header "test --man"
|
||||
cat << END > shared/test.sh
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
export LC_ALL=C.UTF-8
|
||||
$CMD --man | grep --quiet --fixed-strings 'mmdebstrap [OPTION...] [*SUITE* [*TARGET* [*MIRROR*...]]]'
|
||||
END
|
||||
if [ "$HAVE_QEMU" = "yes" ]; then
|
||||
./run_qemu.sh
|
||||
|
|
12
mmdebstrap
12
mmdebstrap
|
@ -1852,7 +1852,8 @@ sub main() {
|
|||
my $logfile = undef;
|
||||
Getopt::Long::Configure ('default', 'bundling', 'auto_abbrev', 'ignore_case_always');
|
||||
GetOptions(
|
||||
'h|help' => sub { pod2usage(-exitval => 0, -verbose => 2) },
|
||||
'h|help' => sub { pod2usage(-exitval => 0, -verbose => 1) },
|
||||
'man' => sub { pod2usage(-exitval => 0, -verbose => 2) },
|
||||
'version' => sub { print STDOUT "mmdebstrap $VERSION\n"; exit 0; },
|
||||
'components=s@' => \$options->{components},
|
||||
'variant=s' => \$options->{variant},
|
||||
|
@ -2756,7 +2757,14 @@ require a double dash and may be abbreviated to uniqueness.
|
|||
|
||||
=item B<-h,--help>
|
||||
|
||||
Print this help text and exit.
|
||||
Print synopsis and options of this man page and exit.
|
||||
|
||||
=item B<--man>
|
||||
|
||||
Show the full man page as generated from Perl POD in a pager. This requires
|
||||
the perldoc program from the perl-doc package. This is the same as running:
|
||||
|
||||
pod2man /usr/bin/mmdebstrap | man -l -
|
||||
|
||||
=item B<--version>
|
||||
|
||||
|
|
Loading…
Reference in a new issue