summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-03-22 09:38:52 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-03-22 09:38:55 -0700
commitfd3989e1fba704e8cece4ff68c14814d272bdc75 (patch)
tree47526b290fc72ec236ffccc77216426ff5fda277
parentc504f3db57bde35394b836f8fccddfe8de7b9f2b (diff)
downloadp5-Git-Annex-fd3989e1fba704e8cece4ff68c14814d272bdc75.tar.gz
annex-review-unused: Add missing prompt_yn subroutine
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-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;