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

echo: remove non-standard -? #417

Merged
merged 1 commit into from
Jan 25, 2024
Merged
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
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
Loading