diff --git a/lib/App/perlbrew.pm b/lib/App/perlbrew.pm index cb27468c..e1adf751 100644 --- a/lib/App/perlbrew.pm +++ b/lib/App/perlbrew.pm @@ -291,6 +291,7 @@ sub parse_cmdline { 'all', 'shell=s', 'no-patchperl', + 'no-decoration', "builddir=s", @@ -2084,18 +2085,27 @@ sub run_command_list { my $self = shift; my $is_verbose = $self->{verbose}; - for my $i ($self->installed_perls) { - printf "%-2s%-20s %-20s %s\n", - $i->{is_current} ? '*' : '', - $i->{name}, - ( $is_verbose ? - (index($i->{name}, $i->{version}) < 0) ? "($i->{version})" : '' - : '' ), - ( $is_verbose ? "(installed on $i->{ctime})" : '' ); - - for my $lib (@{$i->{libs}}) { - print $lib->{is_current} ? "* " : " ", - $lib->{name}, "\n" + if ($self->{'no-decoration'}) { + for my $i ($self->installed_perls) { + print $i->{name} . "\n"; + for my $lib (@{$i->{libs}}) { + print $lib->{name} . "\n"; + } + } + } else { + for my $i ($self->installed_perls) { + printf "%-2s%-20s %-20s %s\n", + $i->{is_current} ? '*' : '', + $i->{name}, + ( $is_verbose ? + (index($i->{name}, $i->{version}) < 0) ? "($i->{version})" : '' + : '' ), + ( $is_verbose ? "(installed on $i->{ctime})" : '' ); + + for my $lib (@{$i->{libs}}) { + print $lib->{is_current} ? "* " : " ", + $lib->{name}, "\n" + } } } diff --git a/t/command-list.t b/t/command-list.t index d9234154..4d947269 100644 --- a/t/command-list.t +++ b/t/command-list.t @@ -57,6 +57,18 @@ describe "list command," => sub { stdout_like sub { $app->run(); }, qr/^(\s|\*)\sc?perl-?\d\.\d{1,3}[_.]\d{1,2}(\@nobita)?/, 'Cannot find Perl with libraries in output' }; + describe "when `--no-decoration` is given", sub { + it "does not mark anything", sub { + $ENV{PERLBREW_LIB} = "nobita"; + my $app = App::perlbrew->new("list", "--no-decoration"); + stdout_like sub { $app->run(); }, qr/^perl-?\d\.\d{1,3}[_.]\d{1,2}(@\w+)?/, 'No decoration mark in the output'; + }; + }; + }; + + describe "when `--no-decoration` is given", sub { + my $app = App::perlbrew->new("list", "--no-decoration"); + stdout_like sub { $app->run(); }, qr/^perl-?\d\.\d{1,3}[_.]\d{1,2}(@\w+)?/, 'No decoration mark in the output'; }; };