Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix domain name command line argument handling #365

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ RUN apk add --no-cache \
perl-app-cpanminus \
perl-module-install \
&& cpanm --no-wget --from https://cpan.metacpan.org/ \
MooseX::Getopt \
Text::Reflow
MooseX::Getopt

ARG version

Expand Down
1 change: 0 additions & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ requires(
'JSON::XS' => 0,
'Locale::TextDomain' => 1.23,
'MooseX::Getopt' => 0,
'Text::Reflow' => 0,
'Try::Tiny' => 0,
'Zonemaster::LDNS' => 3.002000, # v3.2.0
'Zonemaster::Engine' => 4.007003, # v4.7.3
Expand Down
15 changes: 6 additions & 9 deletions lib/Zonemaster/CLI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ use JSON::XS;
use List::Util qw[max uniq];
use POSIX qw[setlocale LC_MESSAGES LC_CTYPE];
use Scalar::Util qw[blessed];
use Socket qw[AF_INET AF_INET6];
use Text::Reflow qw[reflow_string];
use Try::Tiny;
use Net::IP::XS;

Expand All @@ -36,7 +34,6 @@ use Zonemaster::Engine::Normalization qw[normalize_name];
use Zonemaster::Engine::Logger::Entry;
use Zonemaster::Engine::Translator;
use Zonemaster::Engine::Util qw[parse_hints];
use Zonemaster::Engine::Zone;

our %numeric = Zonemaster::Engine::Logger::Entry->levels;
our $JSON = JSON::XS->new->allow_blessed->convert_blessed->canonical;
Expand Down Expand Up @@ -631,18 +628,13 @@ sub run {
}
);

if ( $self->profile or $self->test ) {
# Separate initialization from main output in human readable output mode
print "\n" if $fh_diag eq *STDOUT;
}

if ( scalar @{ $self->extra_argv } > 1 ) {
die __( "Only one domain can be given for testing. Did you forget to prepend an option with '--<OPTION>'?\n" );
}

my ( $domain ) = @{ $self->extra_argv };

if ( not $domain ) {
if ( !defined $domain ) {
die __( "Must give the name of a domain to test.\n" );
}

Expand Down Expand Up @@ -677,6 +669,11 @@ sub run {
$self->add_fake_ds( $domain );
}

if ( $self->profile or $self->test ) {
# Separate initialization from main output in human readable output mode
print "\n" if $fh_diag eq *STDOUT;
}

if ( not $self->raw and not $self->json ) {
my $header = q{};

Expand Down