Skip to content

Commit

Permalink
0.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Aug 18, 2024
1 parent 64bc324 commit 6058b30
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 7 deletions.
8 changes: 8 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ Revision history for App-Rak

{{$NEXT}}

0.3.6 2024-08-18T12:40:54+02:00
- Add support for --per-paragraph to produce haystacks
per paragraph, rather than by line or the whole file
- Bump dependency on String::Utils to get "paragraphs"
with :Pair named argument
- Bump dependency on rak to get ":produce-many-pairs"
functionality

0.3.5 2024-08-17T19:49:18+02:00
- Separate "producer" logic from "action" logic, to allow
e.g. --per-file and --modify-files to be combined
Expand Down
6 changes: 3 additions & 3 deletions META6.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"JSON::Fast::Hyper:ver<0.0.7>:auth<zef:lizmat>",
"META::constants:ver<0.0.4>:auth<zef:lizmat>",
"Needle::Compile:ver<0.0.7>:auth<zef:lizmat>",
"rak:ver<0.0.59>:auth<zef:lizmat>",
"String::Utils:ver<0.0.25+>:auth<zef:lizmat>"
"rak:ver<0.0.60>:auth<zef:lizmat>",
"String::Utils:ver<0.0.27+>:auth<zef:lizmat>"
],
"description": "21st century grep / find / ack / ag / rg on steroids",
"license": "Artistic-2.0",
Expand Down Expand Up @@ -59,5 +59,5 @@
],
"test-depends": [
],
"version": "0.3.5"
"version": "0.3.6"
}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,11 @@ Optionally takes a `Callable` specification: this will be given an `IO::Path` ob
$ rak foo --per-line='*.lines.tail(10)'
```

--per-paragraph
---------------

Indicate whether matching should be done per paragraph. It will read lines with the indicated `--encoding`, combine them into paragraphs and present each paragraph to the matcher, with the line number of the start of the paragraphs associated with it.

--progress
----------

Expand Down
7 changes: 7 additions & 0 deletions doc/App-Rak.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,13 @@ $ rak foo --per-line='*.lines.tail(10)'

=end code

=head2 --per-paragraph

Indicate whether matching should be done per paragraph. It will read lines
with the indicated C<--encoding>, combine them into paragraphs and present
each paragraph to the matcher, with the line number of the start of the
paragraphs associated with it.

=head2 --progress

Flag. If specified, will produce a progress indicator on STDERR that
Expand Down
23 changes: 19 additions & 4 deletions lib/App/Rak.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use as-cli-arguments:ver<0.0.8>:auth<zef:lizmat>; # as-cli-arguments
use IO::Path::AutoDecompress:ver<0.0.3>:auth<zef:lizmat>; # IOAD
use JSON::Fast::Hyper:ver<0.0.7>:auth<zef:lizmat>; # from-json to-json
use META::constants:ver<0.0.4>:auth<zef:lizmat> $?DISTRIBUTION;
use rak:ver<0.0.59>:auth<zef:lizmat>; # rak Rak
use rak:ver<0.0.60>:auth<zef:lizmat>; # rak Rak

use Backtrace::Files:ver<0.0.4>:auth<zef:lizmat> <
backtrace-files
Expand All @@ -14,7 +14,7 @@ use highlighter:ver<0.0.21>:auth<zef:lizmat> <
use Needle::Compile:ver<0.0.7>:auth<zef:lizmat> <
compile-needle implicit2explicit StrType Type
>;
use String::Utils:ver<0.0.26+>:auth<zef:lizmat> <
use String::Utils:ver<0.0.27+>:auth<zef:lizmat> <
after before between has-marks is-sha1 non-word paragraphs regexify
>;

Expand All @@ -31,9 +31,9 @@ my constant BON = "\e[1m"; # BOLD ON
my constant BOFF = "\e[22m"; # BOLD OFF

#- start of available options --------------------------------------------------
#- Generated on 2024-08-16T19:20:19+02:00 by tools/makeOPTIONS.raku
#- Generated on 2024-08-17T22:09:15+02:00 by tools/makeOPTIONS.raku
#- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE
my str @options = <absolute accept accessed ack after-context allow-loose-escapes allow-loose-quotes allow-whitespace and andnot auto-decompress auto-diag backtrace backup batch before-context blame-per-file blame-per-line blocks break checkout classify categorize context count-only created csv-per-line degree deny description device-number dir dont-catch dryrun ecosystem edit encoding eol escape exec execute-raku extensions file file-separator-null files-from files-with-matches files-without-matches filesize find formula frequencies gid group group-matches hard-links has-setgid has-setuid headers help highlight highlight-after highlight-before human ignorecase ignoremark inode invert-match is-empty is-executable is-group-executable is-group-readable is-group-writable is-moarvm is-owned-by-group is-owned-by-user is-owner-executable is-owner-readable is-owner-writable is-pdf is-readable is-sticky is-symbolic-link is-text is-world-executable is-world-readable is-world-writable is-writable json-per-elem json-per-file json-per-line keep-meta list-custom-options list-expanded-options list-known-extensions matches-only max-matches-per-file mbc mbc-frames mbc-strings meta-modified mode modified modify-files module not only-first or ornot output-dir output-file pager paragraph-context passthru passthru-context paths paths-from pattern patterns-from pdf-info pdf-per-file pdf-per-line per-file per-line progress proximate rename-files quietly quote rak recurse-symlinked-dir recurse-unmatched-dir repository save sayer sep shell show-blame show-filename show-item-number silently smartcase smartmark sourcery stats stats-only strict summary-if-larger-than trim type uid under-version-control unicode unique user verbose version vimgrep with-line-endings>;
my str @options = <absolute accept accessed ack after-context allow-loose-escapes allow-loose-quotes allow-whitespace and andnot auto-decompress auto-diag backtrace backup batch before-context blame-per-file blame-per-line blocks break checkout classify categorize context count-only created csv-per-line degree deny description device-number dir dont-catch dryrun ecosystem edit encoding eol escape exec execute-raku extensions file file-separator-null files-from files-with-matches files-without-matches filesize find formula frequencies gid group group-matches hard-links has-setgid has-setuid headers help highlight highlight-after highlight-before human ignorecase ignoremark inode invert-match is-empty is-executable is-group-executable is-group-readable is-group-writable is-moarvm is-owned-by-group is-owned-by-user is-owner-executable is-owner-readable is-owner-writable is-pdf is-readable is-sticky is-symbolic-link is-text is-world-executable is-world-readable is-world-writable is-writable json-per-elem json-per-file json-per-line keep-meta list-custom-options list-expanded-options list-known-extensions matches-only max-matches-per-file mbc mbc-frames mbc-strings meta-modified mode modified modify-files module not only-first or ornot output-dir output-file pager paragraph-context passthru passthru-context paths paths-from pattern patterns-from pdf-info pdf-per-file pdf-per-line per-file per-line per-paragraph progress proximate rename-files quietly quote rak recurse-symlinked-dir recurse-unmatched-dir repository save sayer sep shell show-blame show-filename show-item-number silently smartcase smartmark sourcery stats stats-only strict summary-if-larger-than trim type uid under-version-control unicode unique user verbose version vimgrep with-line-endings>;
#- PLEASE DON'T CHANGE ANYTHING ABOVE THIS LINE
#- end of available options ----------------------------------------------------

Expand Down Expand Up @@ -2088,6 +2088,21 @@ my sub option-per-line($value --> Nil) {
}
}
my sub option-per-paragraph($value --> Nil) {
if Bool.ACCEPTS($value) {
if $value {
set-producer(
'per-line',
-> $io { paragraphs($io.lines, 1, :Pair(PairContext)) },
'produce-many-pairs'
);
}
}
else {
meh "Can only specify '--per-paragraph' as a flag";
}
}
my sub option-progress($value --> Nil) {
my $ERR := PROCESS::<$ERR>;
Expand Down
10 changes: 10 additions & 0 deletions xt/01-simple.rakutest
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,16 @@ nine
7:SIX
OK

query-ok <--per-paragraph five --and=nine>, :!head, ok => qq:to/OK/;
nine
5:four
{BON}five{BOFF}
SIX
seven
eight
{BON}nine{BOFF}
OK

done-testing;

# vim: expandtab shiftwidth=4

0 comments on commit 6058b30

Please sign in to comment.