Skip to content

Commit 1af7418

Browse files
authored
nl: retire -V (#593)
* Linux and OpenBSD don't support nl -V for displaying version * Standards document doesn't specify a version flag[1] * GNU nl has --version, which can be supported here as done for bin/rev 1. https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/nl.html
1 parent 547a038 commit 1af7418

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

bin/nl

+4-6
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ my $program = basename($0);
3232
# options
3333
$Getopt::Std::STANDARD_HELP_VERSION = 1;
3434
my %options = ();
35-
getopts('Vb:d:f:h:i:n:ps:v:w:', \%options) or pod2usage(EX_FAILURE);
35+
getopts('b:d:f:h:i:n:ps:v:w:', \%options) or pod2usage(EX_FAILURE);
3636
my $file = shift;
3737
$file = '-' unless defined $file;
3838
pod2usage(EX_FAILURE) if @ARGV;
3939

40-
my $version = $options{V};
4140
my $type_b = $options{b} || "t";
4241
my $delim = $options{d} || '\:';
4342
my $type_f = $options{f} || "n";
@@ -94,8 +93,8 @@ else {
9493
$incr = 1;
9594
}
9695

97-
if ($version) {
98-
print "$program $VERSION\n";
96+
sub VERSION_MESSAGE {
97+
print "$program version $VERSION\n";
9998
exit EX_SUCCESS;
10099
}
101100

@@ -264,7 +263,7 @@ nl - line numbering filter
264263
265264
=head1 SYNOPSIS
266265
267-
nl [-V] [-p] [-b type] [-d delim] [-f type] [-h type] [-i incr] [-l num]
266+
nl [-p] [-b type] [-d delim] [-f type] [-h type] [-i incr] [-l num]
268267
[-n format] [-s sep] [-v startnum] [-w width] [file]
269268
270269
=head1 DESCRIPTION
@@ -276,7 +275,6 @@ If file is a dash "-" or if no file is given as argument, nl reads from standard
276275
277276
The following options are supported.
278277
279-
-V version
280278
-b type 'a' all lines
281279
't' only non-empty lines (default)
282280
'n' no numbering

0 commit comments

Comments
 (0)