From 43511a9c8cfbb436926aec1c4382003cdab87ee5 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 14 Sep 2019 20:39:14 +0200 Subject: [PATCH] override version option to only show main program Default Getopt::Long results include environment-specific details unlike most other programs, maybe enforcing minimal details in some bug reports, but making test output non-portable. --- barcat | 6 +++++- t/t0001-version_--version.out | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/barcat b/barcat index 1bcda80..db0aefa 100755 --- a/barcat +++ b/barcat @@ -6,7 +6,7 @@ use List::Util qw( min max sum ); use open qw( :std :utf8 ); use experimental qw( lexical_subs ); -our $VERSION = '1.05'; +our $VERSION = '1.06'; use Getopt::Long '2.33', qw( :config gnu_getopt ); my %opt; @@ -53,6 +53,10 @@ GetOptions(\%opt, 'signal-stat=s', 'unmodified|u!', 'width|w=i', + 'version' => sub { + say "barcat version $VERSION"; + exit; + }, 'usage|h' => sub { local $/; my $pod = readline *DATA; diff --git a/t/t0001-version_--version.out b/t/t0001-version_--version.out index 8f670b5..e177fbb 100644 --- a/t/t0001-version_--version.out +++ b/t/t0001-version_--version.out @@ -1,2 +1 @@ -./barcat version 1.05 -(Getopt::Long::GetOptions version 2.48; Perl version 5.24.1) +barcat version 1.06 -- 2.30.0