add --version option

This commit is contained in:
Johannes 'josch' Schauer 2019-02-23 08:55:31 +01:00
parent d73b8396ac
commit a91a825e67
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1
2 changed files with 22 additions and 0 deletions

View file

@ -224,6 +224,21 @@ else
./run_null.sh ./run_null.sh
fi fi
print_header "test --version"
cat << END > shared/test.sh
#!/bin/sh
set -eu
export LC_ALL=C.UTF-8
$CMD --version | egrep --quiet '^mmdebstrap [0-9](\.[0-9])+$'
END
if [ "$HAVE_QEMU" = "yes" ]; then
./run_qemu.sh
elif [ "$defaultmode" = "root" ]; then
./run_null.sh SUDO
else
./run_null.sh
fi
print_header "mode=root,variant=apt: create directory" print_header "mode=root,variant=apt: create directory"
cat << END > shared/test.sh cat << END > shared/test.sh
#!/bin/sh #!/bin/sh

View file

@ -15,6 +15,8 @@
use strict; use strict;
use warnings; use warnings;
our $VERSION = '0.3.0';
use English; use English;
use Getopt::Long; use Getopt::Long;
use Pod::Usage; use Pod::Usage;
@ -1699,6 +1701,7 @@ sub main() {
Getopt::Long::Configure ('default', 'bundling', 'auto_abbrev', 'ignore_case_always'); Getopt::Long::Configure ('default', 'bundling', 'auto_abbrev', 'ignore_case_always');
GetOptions( GetOptions(
'h|help' => sub { pod2usage(-exitval => 0, -verbose => 2) }, 'h|help' => sub { pod2usage(-exitval => 0, -verbose => 2) },
'version' => sub { print STDOUT "mmdebstrap $VERSION\n"; exit 0; },
'components=s' => \$options->{components}, 'components=s' => \$options->{components},
'variant=s' => \$options->{variant}, 'variant=s' => \$options->{variant},
'include=s' => \$options->{include}, 'include=s' => \$options->{include},
@ -2445,6 +2448,10 @@ require a double dash and may be abbreviated to uniqueness.
Print this help text and exit. Print this help text and exit.
=item B<--version>
Print the B<mmdebstrap> version and exit.
=item B<--variant>=I<name> =item B<--variant>=I<name>
Choose which package set to install. Valid variant I<name>s are B<extract>, Choose which package set to install. Valid variant I<name>s are B<extract>,