@@ -43,22 +43,14 @@ has exit_code => (
43
43
);
44
44
45
45
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,
50
50
documentation =>
51
51
' seconds before connection is considered failed with timeout' ,
52
52
);
53
53
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
-
62
54
has ua => (
63
55
is => ' ro' ,
64
56
lazy => 1,
@@ -87,10 +79,10 @@ has model => (
87
79
);
88
80
89
81
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' ,
94
86
documentation =>
95
87
' Index to use, defaults to "cpan" (when used: also export ES_SCRIPT_INDEX)' ,
96
88
);
@@ -267,7 +259,7 @@ sub check_health {
267
259
my $sinfo_rs
268
260
= $self -> es-> cat-> indices( h => [ ' index' , ' health' ] );
269
261
270
- $self -> indices_info({} );
262
+ $self -> indices_info( {} );
271
263
272
264
while ( $sinfo_rs =~ / ^([^[:space:]]+) +([^[:space:]]+)/gm ) {
273
265
$self -> indices_info-> {$1 }
@@ -289,7 +281,7 @@ sub check_health {
289
281
my $sinfo_rs
290
282
= $self -> es-> cat-> aliases( h => [ ' alias' , ' index' ] );
291
283
292
- $self -> aliases_info({} );
284
+ $self -> aliases_info( {} );
293
285
294
286
while ( $sinfo_rs =~ / ^([^[:space:]]+) +([^[:space:]]+)/gm ) {
295
287
$self -> aliases_info-> {$1 }
@@ -349,7 +341,7 @@ sub await {
349
341
350
342
# Set System Error: 112 - EHOSTDOWN - Host is down
351
343
$self -> exit_code(112);
352
- $self -> handle_error($@ , 1);
344
+ $self -> handle_error( $@ , 1 );
353
345
}
354
346
}
355
347
} while ( !$iready && $iseconds <= $self -> arg_await_timeout );
@@ -365,20 +357,15 @@ sub await {
365
357
sub are_you_sure {
366
358
my ( $self , $msg ) = @_ ;
367
359
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;
378
367
}
379
- }
380
- else {
381
- print colored( [' yellow' ], " Notice: $msg " ), " \n " ;
368
+ print " alright then...\n " ;
382
369
}
383
370
}
384
371
@@ -412,13 +399,6 @@ After C<await> seconds the Application will fail with an Exception and the Exit
412
399
413
400
See L<Method C<await()> >
414
401
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
-
422
402
=back
423
403
424
404
=head1 METHODS
0 commit comments