diff options
Diffstat (limited to 'lib/App/annex_review_unused.pm')
-rw-r--r-- | lib/App/annex_review_unused.pm | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/App/annex_review_unused.pm b/lib/App/annex_review_unused.pm index 2527193..eae6cd0 100644 --- a/lib/App/annex_review_unused.pm +++ b/lib/App/annex_review_unused.pm @@ -170,11 +170,10 @@ sub main { } if (@to_drop) { - _say_spaced_bullet("Will dropunused" - . (exists $dropunused_args{force} ? " with --force:" : ":")); + _say_spaced_bullet("Will dropunused with --force:"); say "@to_drop\n"; - $annex->annex->dropunused(\%dropunused_args, @to_drop) - if prompt_yn("Go ahead with this?"); + $annex->annex->dropunused(\%dropunused_args, "--force", @to_drop) + if _prompt_yn("Go ahead with this?"); } # exit value represents whether or not there are any unused files left @@ -192,6 +191,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; |