aboutsummaryrefslogtreecommitdiff
path: root/sboclean
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-09-07 00:26:22 +0200
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-09-07 00:26:22 +0200
commitda1b7f300ad26b9410c11ef0e5c49b783cc29c67 (patch)
tree95fe851682cfd3305c3d5551f41e9a0017dd7a9a /sboclean
parent50f048b798478ba98c6e8043b7e518815f9f8c3a (diff)
downloadsbotools-da1b7f300ad26b9410c11ef0e5c49b783cc29c67.tar.xz
sbo*, SBO::Lib::*: make use of prompt() for getting user input
Diffstat (limited to 'sboclean')
-rwxr-xr-xsboclean8
1 files changed, 3 insertions, 5 deletions
diff --git a/sboclean b/sboclean
index 6e080b9..5551333 100755
--- a/sboclean
+++ b/sboclean
@@ -13,7 +13,7 @@
use 5.16.0;
use strict;
use warnings FATAL => 'all';
-use SBO::Lib qw/ usage_error script_error in show_version %config /;
+use SBO::Lib qw/ prompt usage_error script_error in show_version %config /;
use File::Basename;
use Getopt::Long qw(:config bundling);
use File::Path qw(remove_tree);
@@ -60,8 +60,7 @@ sub rm_full {
script_error('rm_full requires an argument.') unless @_ == 1;
my $full = shift;
if ($interactive) {
- print "Remove $full? [n] ";
- return() unless <STDIN> =~ /^[Yy]/;
+ return() unless prompt("Remove $full?", default => 'no');
}
unlink $full if -f $full;
remove_tree($full) if -d $full;
@@ -100,8 +99,7 @@ if ($clean_work) {
my $tsbo = $SBO::Lib::tmpd;
if ($env_tmp && !$interactive) {
warn "This will remove the entire contents of $env_tmp\n";
- print "Proceed? [y] ";
- remove_stuff($tsbo) if <STDIN> =~ /^[yY\n]/;
+ remove_stuff($tsbo) if prompt("Proceed?", default => 'yes');
} else {
remove_stuff($tsbo);
}