diff --git a/lib/SLUB/LZA/TA/Command/info.pm b/lib/SLUB/LZA/TA/Command/info.pm index 61c3ec6187f4ec056d0d51e5f694c2a7c00dadb0..f2841cb7d04473491c77a27be64ceab3898fb3c4 100644 --- a/lib/SLUB/LZA/TA/Command/info.pm +++ b/lib/SLUB/LZA/TA/Command/info.pm @@ -20,19 +20,19 @@ sub description { sub opt_spec { my @global_opts= SLUB::LZA::TA::common_global_opt_spec(); my @local_opts = ( - [ 'target-version|T' => 'get current elasticsearch version', { shortcircuit => 1 } ], - [ 'version|V', 'print '.$0.' version information', { shortcircuit => 1 } ], + [ 'target-version|T' => 'get current elasticsearch version'], + [ 'version|V', 'print '.$0.' version information'], ); return (@global_opts, [], @local_opts); } sub validate_args { my ($self, $opt, $args) = @_; + SLUB::LZA::TA::common_global_validate($self, $opt, $args); # no args allowed but options! $self->usage_error("No args allowed") if @$args; return 1; } - sub execute { my ($self, $opt, $args) = @_; if ($opt->{target_version}) { diff --git a/t/03-info.t b/t/03-info.t index 4c58b07aaa0f495a485374b702fde9ca12e06777..6aa02612ed329518b5d111e63a71c2016cca0888 100644 --- a/t/03-info.t +++ b/t/03-info.t @@ -1,6 +1,6 @@ use v5.36; use Test::Cmd; -use Test::More tests =>12; +use Test::More tests =>15; use Path::Tiny; my $perl = $^X; my $testapp = Test::Cmd->new( @@ -28,6 +28,7 @@ user: lza _CFG_ # tests +note "help check"; foreach my $param ("help info", "info -h", "info --help") { $testapp->run(args => $param); #say "STDOUT:",$testapp->stdout; @@ -43,4 +44,12 @@ like($testapp->stdout, qr/^6\.\d\.\d{1,2}$/, 'ta-tool elasticsearch version, std like($testapp->stderr, qr/^$/, 'ta-tool elasticsearch version, stderr'); is($? >> 8, 0, 'ta-tool elasticsearch version, exit status'); +$testapp->run(args =>'info --elasticsearch-host localhost --target-version'); +#say "STDOUT:",$testapp->stdout; +#say "STDERR:",$testapp->stderr; +like($testapp->stdout, qr/^$/, 'ta-tool elasticsearch version, stdout'); +like($testapp->stderr, qr/^Hint: override local config/, 'ta-tool elasticsearch version, stderr'); +is($? >> 8, 111, 'ta-tool elasticsearch version, exit status'); + + 1;