Skip to content

Commit

Permalink
Add --no-prompt option to reindexdist script
Browse files Browse the repository at this point in the history
  • Loading branch information
rwstauner committed Jan 15, 2015
1 parent 47d5985 commit 032e592
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/MetaCPAN/Script/ReindexDist.pm
Expand Up @@ -45,6 +45,13 @@ has sources => (
lazy_build => 1,
);

has prompt => (
is => 'ro',
isa => 'Bool',
default => 1,
documentation => q{Prompt for confirmation (default true)},
);

sub _build_sources {
my ($self) = @_;
return [ map { $_->download_url } @{ $self->releases } ];
Expand Down Expand Up @@ -73,8 +80,13 @@ sub confirm {
if !@{ $self->releases };

print "Reindexing ${\ $self->distribution }\n",
( map {" $_\n"} @{ $self->sources } ),
"Continue? (y/n): ";
( map {" $_\n"} @{ $self->sources } );

if ( !$self->prompt ) {
return;
}

print 'Continue? (y/n): ';

my $confirmation = <STDIN>;

Expand Down

0 comments on commit 032e592

Please sign in to comment.