summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-12-08 06:16:01 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-12-08 06:16:01 (GMT)
commitf0ea9667eaca528221a87dc455cdd1900f50c4c1 (patch)
tree0b74fed1f209a97d3503f50ba314d34ac5b4cc28 /lib
parent5c1ce65bcb85772cd06d5bef7d2afd8add5c1593 (diff)
ask for confirmation on user/group removal
Diffstat (limited to 'lib')
-rwxr-xr-xlib/RHRD/utils.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/RHRD/utils.pm b/lib/RHRD/utils.pm
index 756707b..ad8e7b8 100755
--- a/lib/RHRD/utils.pm
+++ b/lib/RHRD/utils.pm
@@ -213,6 +213,20 @@ sub cmdline_dow
return (undef, 'invalid day-of-week', CMDLINE_DOW_HINT);
}
+sub cmdline_ask_yn
+{
+ my ($question) = @_;
+
+ print "$question (y/N)? ";
+ my $answer = <STDIN>;
+ chomp($answer) if(defined $answer);
+ unless(defined $answer && lc($answer) eq 'y') {
+ print "aborting.\n";
+ return 0;
+ }
+ return 1;
+}
+
sub fetch_parse_json
{
my ($url, $ua_str, $headers, $queries) = @_;