Skip to content

Commit

Permalink
CI tests for 0.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Aug 4, 2024
1 parent 5063326 commit 62311df
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
Revision history for App-Rak

{{$NEXT}}
- Added support for --ack to activate a compatibility
layer for former "ack" users.
- Added dependency on Needle::Compile to handle all the
pattern to Callable issues
pattern to Callable issues (just for CI for now)
- Upped all dependencies where applicable
- Hoperfully fixed Windows CI for now

Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,18 @@ If specified, indicates the `Callable` that should return True to include a file

See "CHECKING TIMES ON FILES" for more information about features that can be used inside the `Callable`.

--ack
-----

Attempt to interpret following arguments as if they were arguments to the [`ack`](https://metacpan.org/pod/ack) utility. This is incomplete and may be subtly different in behaviour. Intended as a temporary measure for people used to using `ack`, while they train their muscle memory to use **rak** instead.

If you'd like a list of the option configuration, you can use the `--list-custom-options` argument.

```bash
# Show the current mappinng of "ack" to "rak" options
$ rak --ack --list-custom-options
```

--after-context=N
-----------------

Expand Down
18 changes: 18 additions & 0 deletions doc/App-Rak.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,24 @@ reliably.
See "CHECKING TIMES ON FILES" for more information about features that
can be used inside the C<Callable>.

=head2 --ack

Attempt to interpret following arguments as if they were arguments to the
L<C<ack>|https://metacpan.org/pod/ack> utility. This is incomplete and
may be subtly different in behaviour. Intended as a temporary measure
for people used to using C<ack>, while they train their muscle memory
to use B<rak> instead.

If you'd like a list of the option configuration, you can use the
C<--list-custom-options> argument.

=begin code :lang<bash>

# Show the current mappinng of "ack" to "rak" options
$ rak --ack --list-custom-options

=end code

=head2 --after-context=N

Indicate the number of lines that should be shown B<after> any line that
Expand Down
54 changes: 52 additions & 2 deletions lib/App/Rak.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ my constant BON = "\e[1m"; # BOLD ON
my constant BOFF = "\e[22m"; # BOLD OFF

#- start of available options --------------------------------------------------
#- Generated on 2024-05-12T20:26:03+02:00 by tools/makeOPTIONS.raku
#- Generated on 2024-08-04T16:31:51+02:00 by tools/makeOPTIONS.raku
#- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE
my str @options = <absolute accept accessed after-context allow-loose-escapes allow-loose-quotes allow-whitespace 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 only-first 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 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 only-first 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>;
#- PLEASE DON'T CHANGE ANYTHING ABOVE THIS LINE
#- end of available options ----------------------------------------------------

Expand Down Expand Up @@ -91,6 +91,52 @@ my constant %falsies =
unrestricted => 'dir',
;

# The JSON config to map "ack" arguments to "rak" arguments as closely as possible
my constant %ack-interface-config =
"1" => (:only-first,),
"A" => (:after-context<!>,),
"B" => (:before-context<!>,),
"c" => (:count-only,),
"C" => (:context<[2]>,),
"count" => (:count-only,),
"dump" => (:list-expanded-options,),
"f" => (:find,),
"filename" => (:show-filename,),
"follow" => (:recurse-symlinked-dir,),
"group" => (:group-matches,),
"h" => (:!show-filename,),
"H" => (:show-filename,),
"heading" => (:group-matches,),
"help-types" => (:extensions<[*]>,),
"i" => (:ignorecase,),
"I" => (:!ignorecase,),
"ignore-case" => (:ignorecase,),
"ignore-dir" => (:dir,),
"ignore-directory" => (:dir,),
"k" => (:extensions<[*]>,),
"known-types" => (:extensions<[*]>,),
"l" => (:files-with-matches,),
"L" => (:files-without-matches,),
"m" => (:max-matches-per-file,),
"n" => (:!dir,),
"man" => (:help,),
"match" => (:pattern,),
"max-count" => (:max-matches-per-file,),
"o" => (:matches-only,),
"output" => (:pattern,),
"p" => (:proximate<!>,),
"P" => (:proximate<0>,),
"print0" => (:file-separator-null,),
"S" => (:smartcase,),
"smart-case" => (:smartcase,),
"t" => (:extensions<!>,),
"type" => (:extensions<!>,),
"TYPE" => (:extensions<!>,),
"v" => (:invert-match,),
"with-filename" => (:show-filename,),
"x" => (:files-from<->,),
;

# Options that only make sense after one main option
my constant %sub-options =
allow-loose-escapes => 'csv-per-line',
Expand Down Expand Up @@ -1526,6 +1572,10 @@ my sub option-accessed($value --> Nil) {
set-filesystem-Instant('accessed', $value)
}
my sub option-ack($value --> Nil) {
%config := %ack-interface-config;
}
my sub option-after-context($value --> Nil) {
set-result-Int('after-context', $value);
}
Expand Down
1 change: 1 addition & 0 deletions resources/help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ Option management:
--save=name Translate --name to all other options specified,
remove if --save was the only option specified
--description=text Add description to custom option
--ack Activate "ack" compatibility options
--list-custom-options List all previously saved options

General options:
Expand Down
10 changes: 9 additions & 1 deletion resources/help/option.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ $ rak --description="Perform search without regards to case" --save=i
# Add custom option --y with description
$ rak --description='Yep, there is a codepoint for it' --unicode --save=y

--ack

Attempt to interpret following arguments as if they were arguments to the
"ack" utility. This is incomplete and may be subtly different in behaviour.
Intended as a temporary measure for people used to using "ack", while they
train their muscle memory to use "rak" instead.

--list-custom-options

List all currently known custom options. Must be the only argument.
List all currently known custom options. Must be the only argument, but
can also be used in conjunction with --ack.

0 comments on commit 62311df

Please sign in to comment.