Skip to content

Commit

Permalink
Merge pull request #417 from mknos/echo-question
Browse files Browse the repository at this point in the history
echo: remove non-standard -?
  • Loading branch information
briandfoy authored Jan 25, 2024
2 parents 469f392 + 5181f2c commit 1edbc9c
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions bin/echo
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,15 @@ package PerlPowerTools::echo;

use strict;

my ($VERSION) = '1.2';
my ($VERSION) = '1.3';

__PACKAGE__->run( @ARGV ) unless caller();

sub run {
my ( $self, @args ) = @_;

unless (@args) {
print "\n";
exit 0;
}

if ($args[0] eq '-?') {
print <<EOF;
Usage: echo [-n] [arguments]
Displays the command line arguments, seperated by spaces.
Options:
-n: Do not print a newline after the arguments.
-?: Display usage information.
EOF
exit 0;
}

my $N = 1;
if ($args[0] eq '-n') {
if (@args && $args[0] eq '-n') {
$N = 0;
shift @args;
}
Expand All @@ -50,7 +32,6 @@ EOF
print "\n" if $N == 1;

exit 0;

}

1;
Expand All @@ -69,7 +50,7 @@ echo [-n] [arguments...]
=head1 DESCRIPTION
echo prints the command line arguments seperated by spaces. A newline is
echo prints the command line arguments separated by spaces. A newline is
printed at the end unless the '-n' option is given.
=head2 OPTIONS
Expand All @@ -82,10 +63,6 @@ I<echo> accepts the following options:
Do not print a newline after the arguments.
=item -?
Print out a short help message, then exit.
=back
=head1 ENVIRONMENT
Expand Down

0 comments on commit 1edbc9c

Please sign in to comment.