summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes1
-rw-r--r--lib/App/annex_review_unused.pm13
2 files changed, 14 insertions, 0 deletions
diff --git a/Changes b/Changes
index b27b32f..fd88f5d 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
Revision history for Git::Annex
{{$NEXT}}
+ - annex-review-unused: Add missing prompt_yn subroutine.
0.004 2020-03-18 17:08:57-07:00 America/Phoenix
- annex-to-annex-dropunused: Fix attempt to call wrong main()
diff --git a/lib/App/annex_review_unused.pm b/lib/App/annex_review_unused.pm
index 2527193..340c17f 100644
--- a/lib/App/annex_review_unused.pm
+++ b/lib/App/annex_review_unused.pm
@@ -192,6 +192,19 @@ sub _say_bullet { _say_bold(" • ", @_) }
sub _say_spaced_bullet { _say_bold("\n", " • ", @_, "\n") }
+sub prompt_yn {
+ my $prompt = shift;
+ local $| = 1;
+ my $response;
+ while (1) {
+ print colored(['bold'], "$prompt ");
+ chomp(my $response = <STDIN>);
+ return 1 if lc($response) eq "y";
+ return 0 if lc($response) eq "n";
+ say "invalid response";
+ }
+}
+
sub exit { $exit_main = shift // 0; goto EXIT_MAIN }
1;