Skip to content

Commit 7f4d72b

Browse files
removing option "--yes"
1 parent 55883c1 commit 7f4d72b

File tree

1 file changed

+19
-39
lines changed

1 file changed

+19
-39
lines changed

lib/MetaCPAN/Role/Script.pm

+19-39
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,14 @@ has exit_code => (
4343
);
4444

4545
has arg_await_timeout => (
46-
init_arg => 'await',
47-
is => 'ro',
48-
isa => Int,
49-
default => 15,
46+
init_arg => 'await',
47+
is => 'ro',
48+
isa => Int,
49+
default => 15,
5050
documentation =>
5151
'seconds before connection is considered failed with timeout',
5252
);
5353

54-
has arg_yes => (
55-
init_arg => 'yes',
56-
is => 'ro',
57-
isa => Bool,
58-
default => 0,
59-
documentation => 'automatically accept all operations',
60-
);
61-
6254
has ua => (
6355
is => 'ro',
6456
lazy => 1,
@@ -87,10 +79,10 @@ has model => (
8779
);
8880

8981
has index => (
90-
reader => '_index',
91-
is => 'ro',
92-
isa => Str,
93-
default => 'cpan',
82+
reader => '_index',
83+
is => 'ro',
84+
isa => Str,
85+
default => 'cpan',
9486
documentation =>
9587
'Index to use, defaults to "cpan" (when used: also export ES_SCRIPT_INDEX)',
9688
);
@@ -267,7 +259,7 @@ sub check_health {
267259
my $sinfo_rs
268260
= $self->es->cat->indices( h => [ 'index', 'health' ] );
269261

270-
$self->indices_info({});
262+
$self->indices_info( {} );
271263

272264
while ( $sinfo_rs =~ /^([^[:space:]]+) +([^[:space:]]+)/gm ) {
273265
$self->indices_info->{$1}
@@ -289,7 +281,7 @@ sub check_health {
289281
my $sinfo_rs
290282
= $self->es->cat->aliases( h => [ 'alias', 'index' ] );
291283

292-
$self->aliases_info({});
284+
$self->aliases_info( {} );
293285

294286
while ( $sinfo_rs =~ /^([^[:space:]]+) +([^[:space:]]+)/gm ) {
295287
$self->aliases_info->{$1}
@@ -349,7 +341,7 @@ sub await {
349341

350342
#Set System Error: 112 - EHOSTDOWN - Host is down
351343
$self->exit_code(112);
352-
$self->handle_error($@, 1);
344+
$self->handle_error( $@, 1 );
353345
}
354346
}
355347
} while ( !$iready && $iseconds <= $self->arg_await_timeout );
@@ -365,20 +357,15 @@ sub await {
365357
sub are_you_sure {
366358
my ( $self, $msg ) = @_;
367359

368-
unless ( $self->arg_yes ) {
369-
if (is_interactive) {
370-
print colored( ['bold red'], "*** Warning ***: $msg" ), "\n";
371-
my $answer = prompt
372-
'Are you sure you want to do this (type "YES" to confirm) ? ';
373-
if ( $answer ne 'YES' ) {
374-
print "bye.\n";
375-
exit 0;
376-
}
377-
print "alright then...\n";
360+
if (is_interactive) {
361+
print colored( ['bold red'], "*** Warning ***: $msg" ), "\n";
362+
my $answer = prompt
363+
'Are you sure you want to do this (type "YES" to confirm) ? ';
364+
if ( $answer ne 'YES' ) {
365+
print "bye.\n";
366+
exit 0;
378367
}
379-
}
380-
else {
381-
print colored( ['yellow'], "Notice: $msg" ), "\n";
368+
print "alright then...\n";
382369
}
383370
}
384371

@@ -412,13 +399,6 @@ After C<await> seconds the Application will fail with an Exception and the Exit
412399
413400
See L<Method C<await()>>
414401
415-
=item Option C<--yes>
416-
417-
This option will automatically accept all operations. In C<are_you_sure()> it will not show the warning.
418-
It will show the message as notice instead.
419-
420-
bin/metacpan <script_name> --yes
421-
422402
=back
423403
424404
=head1 METHODS

0 commit comments

Comments
 (0)