From fd3989e1fba704e8cece4ff68c14814d272bdc75 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 22 Mar 2020 09:38:52 -0700 Subject: annex-review-unused: Add missing prompt_yn subroutine Signed-off-by: Sean Whitton --- Changes | 1 + lib/App/annex_review_unused.pm | 13 +++++++++++++ 2 files changed, 14 insertions(+) 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 = ); + 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; -- cgit v1.2.3 From fbbf46846a2b1879438f823360efde8c67743f73 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 22 Mar 2020 09:39:45 -0700 Subject: annex-review-unused: Always pass --force to 'git annex dropunused' Signed-off-by: Sean Whitton --- Changes | 2 ++ lib/App/annex_review_unused.pm | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index fd88f5d..ecab379 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,8 @@ Revision history for Git::Annex {{$NEXT}} - annex-review-unused: Add missing prompt_yn subroutine. + - annex-review-unused: Always pass --force to 'git annex dropunused'. + Previously it couldn't be passed at all, which is much less useful. 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 340c17f..5c5e5a7 100644 --- a/lib/App/annex_review_unused.pm +++ b/lib/App/annex_review_unused.pm @@ -170,10 +170,9 @@ 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) + $annex->annex->dropunused(\%dropunused_args, "--force", @to_drop) if prompt_yn("Go ahead with this?"); } -- cgit v1.2.3 From 767057768a49e73f523939c2f43da0f65f684638 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 23 Mar 2020 11:49:13 -0700 Subject: bump version Signed-off-by: Sean Whitton --- dist.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist.ini b/dist.ini index deb765e..b7d27d0 100644 --- a/dist.ini +++ b/dist.ini @@ -4,7 +4,7 @@ license = GPL_3 copyright_holder = Sean Whitton copyright_year = 2019-2020 -version = 0.004 +version = 0.005 [PkgVersion] [PodWeaver] -- cgit v1.2.3 From 9b579adba92e8b01ff31542ef69b4cad735115f9 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 23 Mar 2020 11:55:29 -0700 Subject: prefix prompt_yn with an underscore Signed-off-by: Sean Whitton --- lib/App/annex_review_unused.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/App/annex_review_unused.pm b/lib/App/annex_review_unused.pm index 5c5e5a7..eae6cd0 100644 --- a/lib/App/annex_review_unused.pm +++ b/lib/App/annex_review_unused.pm @@ -173,7 +173,7 @@ sub main { _say_spaced_bullet("Will dropunused with --force:"); say "@to_drop\n"; $annex->annex->dropunused(\%dropunused_args, "--force", @to_drop) - if prompt_yn("Go ahead with this?"); + if _prompt_yn("Go ahead with this?"); } # exit value represents whether or not there are any unused files left @@ -191,7 +191,7 @@ sub _say_bullet { _say_bold(" • ", @_) } sub _say_spaced_bullet { _say_bold("\n", " • ", @_, "\n") } -sub prompt_yn { +sub _prompt_yn { my $prompt = shift; local $| = 1; my $response; -- cgit v1.2.3 From 9c43d14b9e1f670404f8b5b121632edc0bee373e Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 23 Mar 2020 11:57:23 -0700 Subject: v0.005 - annex-review-unused: Add missing prompt_yn subroutine. - annex-review-unused: Always pass --force to 'git annex dropunused'. Previously it couldn't be passed at all, which is much less useful. Signed-off-by: Sean Whitton --- Changes | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changes b/Changes index ecab379..7837fcd 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for Git::Annex {{$NEXT}} + +0.005 2020-03-23 11:55:48-07:00 America/Phoenix - annex-review-unused: Add missing prompt_yn subroutine. - annex-review-unused: Always pass --force to 'git annex dropunused'. Previously it couldn't be passed at all, which is much less useful. -- cgit v1.2.3