Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
DuckPAN: use _print_msg internally.
Browse files Browse the repository at this point in the history
This fixes a bug with exit_with_msg.. as well as preparing for the
future goodness.

Also, a mis-aligned exit code for the unknown command path.
  • Loading branch information
mwmiller committed Nov 7, 2014
1 parent 344f059 commit 8edd367
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/App/DuckPAN.pm
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ sub execute {
}
exit $self->perl->duckpan_install(@modules) unless @left_args;
}
$self->exit_with_msg(-1, "Unknown command. Use `duckpan help` to see the list of available DuckPAN commands.");
$self->exit_with_msg(0, "Unknown command. Use `duckpan help` to see the list of available DuckPAN commands.");
}

sub show_msg { shift->_print_msg(*STDOUT, @_); }
Expand Down Expand Up @@ -291,7 +291,7 @@ sub exit_with_msg {
@msg = map { '[FATAL ERROR] ' . $_ } grep { $_ } @msg; # And append error warning
}

$self->show_msg(@msg);
$self->_print_msg($which_way, @msg);
exit $exit_code;
}

Expand All @@ -301,13 +301,13 @@ sub verbose_msg {
return unless $self->verbose && @lines; # only show actual messages in verbose mode.

# Someday we may wish to do something more with these, but for now it's just show_msg.
return $self->show_msg(@lines);
return $self->_print_msg(*STDOUT, @lines);
}

sub warning_msg {
my ($self, @msg) = @_;

$self->show_msg(map { '[NOTICE] ' . $_ } grep { $_ } @msg);
$self->_print_msg(*STDOUT, map { '[NOTICE] ' . $_ } grep { $_ } @msg);
}

sub camel_to_underscore {
Expand Down

0 comments on commit 8edd367

Please sign in to comment.