From b5cc8add0bc645eb3c3410af645ee70d8dee2f17 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 28 Dec 2019 19:18:06 +0000 Subject: always determine the contentlocation, for the sake of xdg-open --- lib/perl5/Local/MrRepo/Repo/Git/Annex.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm b/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm index 866f6293..0d7989eb 100644 --- a/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm +++ b/lib/perl5/Local/MrRepo/Repo/Git/Annex.pm @@ -105,7 +105,7 @@ sub review_unused { # already (in the case of reviewing unused files at a remote, # just check that it's not been dropped according to the local # git-annex branch) use checkpresentkey in that case - my $contentlocation; + my $contentlocation = $self->abs_contentlocation($unused_file->{key}); if (defined $opts{from}) { try { $self->git->annex("readpresentkey", $unused_file->{key}, $uuid); @@ -114,7 +114,6 @@ sub review_unused { $i++, next UNUSED; }; } else { - $contentlocation = $self->abs_contentlocation($unused_file->{key}); $i++, next UNUSED unless defined $contentlocation; } @@ -143,9 +142,10 @@ sub review_unused { ReadMode 4; while (defined ReadKey(-1)) { } - $i > 0 - ? print "Drop this unused file? (y/n/o/d/b) " - : print "Drop this unused file? (y/n/o) "; + my @opts = ('y', 'n'); + push @opts, 'o' if defined $contentlocation; + push @opts, ('d', 'b') if $i > 0; + print "Drop this unused files? (".join('/', @opts).") "; # Term::ReadKey docs recommend ReadKey(-1) but # that means we need an infinite loop calling @@ -164,7 +164,7 @@ sub review_unused { last; } elsif ($response eq 'n') { last; - } elsif ($response eq 'o') { + } elsif ($response eq 'o' and defined $contentlocation) { system('xdg-open', $contentlocation); } elsif ($response eq 'b' and $i > 0) { pop @to_drop -- cgit v1.2.3