Skip to content

Commit

Permalink
Allow --edit to work with --files-with(out)-matches
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed May 9, 2024
1 parent ff49156 commit aa73d47
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 16 additions & 2 deletions lib/App/Rak.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -2715,15 +2715,17 @@ my sub action-edit(--> Nil) {
%rak<max-matches-per-source> := $_
with %result<max-matches-per-file>:delete;
my $find := %result<find>:delete;
my $find := %result<find>:delete;
my $files-with-matches := %result<files-with-matches>:delete;
my $files-without-matches := %result<files-without-matches>:delete;
meh-for 'edit', <output-file pager result modify csv>;
prepare-needle;
move-filesystem-options-to-rak;
my $editor := Bool.ACCEPTS($action) ?? Any !! $action;
# find filenames to edit
# Find filenames to edit
if $find {
%rak<find> := True;
%rak<omit-item-number> := True;
Expand All @@ -2732,6 +2734,18 @@ my sub action-edit(--> Nil) {
}
}
# Use filenames of (non-)matches
elsif $files-with-matches || $files-without-matches {
%rak<sources-only> := True if $files-with-matches;
%rak<sources-without-only> := True if $files-without-matches;
my @files;
%rak<mapper> := -> $io --> Empty {
LAST edit-files @files, :$editor;
@files.push: $io.relative;
}
}
# Look for locations in files to edit
else {
my @files;
Expand Down

0 comments on commit aa73d47

Please sign in to comment.