From aa73d470e286dc77af62ba90d90e78b9005bcc78 Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Thu, 9 May 2024 20:00:56 +0200 Subject: [PATCH] Allow --edit to work with --files-with(out)-matches --- Changes | 2 ++ lib/App/Rak.rakumod | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 84959ae..42c4b6f 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for App-Rak {{$NEXT}} + - Allow --edit to work with --files-with-matches and + --files-without-matches 0.2.23 2024-05-09T13:51:24+02:00 - Upped dependency on "rak" to fix issue with readability of diff --git a/lib/App/Rak.rakumod b/lib/App/Rak.rakumod index 5fc689d..36f8d35 100644 --- a/lib/App/Rak.rakumod +++ b/lib/App/Rak.rakumod @@ -2715,7 +2715,9 @@ my sub action-edit(--> Nil) { %rak := $_ with %result:delete; - my $find := %result:delete; + my $find := %result:delete; + my $files-with-matches := %result:delete; + my $files-without-matches := %result:delete; meh-for 'edit', ; @@ -2723,7 +2725,7 @@ my sub action-edit(--> Nil) { move-filesystem-options-to-rak; my $editor := Bool.ACCEPTS($action) ?? Any !! $action; - # find filenames to edit + # Find filenames to edit if $find { %rak := True; %rak := True; @@ -2732,6 +2734,18 @@ my sub action-edit(--> Nil) { } } + # Use filenames of (non-)matches + elsif $files-with-matches || $files-without-matches { + %rak := True if $files-with-matches; + %rak := True if $files-without-matches; + + my @files; + %rak := -> $io --> Empty { + LAST edit-files @files, :$editor; + @files.push: $io.relative; + } + } + # Look for locations in files to edit else { my @files;