summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-12-28 19:18:06 +0000
committerSean Whitton <spwhitton@spwhitton.name>2019-12-28 19:18:06 +0000
commitb5cc8add0bc645eb3c3410af645ee70d8dee2f17 (patch)
tree988b085e8ce1ae1744dc5fc432ae11482300cbf1 /lib
parentab8fd1b79fa7918916eeb73b8e023524ecdea13b (diff)
downloaddotfiles-b5cc8add0bc645eb3c3410af645ee70d8dee2f17.tar.gz
always determine the contentlocation, for the sake of xdg-open
Diffstat (limited to 'lib')
-rw-r--r--lib/perl5/Local/MrRepo/Repo/Git/Annex.pm12
1 files changed, 6 insertions, 6 deletions
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