Skip to content

Commit

Permalink
Upped several dependencies
Browse files Browse the repository at this point in the history
- Made --show-blame work again
- Made --matches-only work in a sane way, with --unique and --frequencies
- Made --passthru work
- Fixed various pod / help / code mismatches

Almost ready for a proper beta-release
  • Loading branch information
lizmat committed Aug 30, 2022
1 parent 8a2efb3 commit 77668cd
Show file tree
Hide file tree
Showing 8 changed files with 266 additions and 81 deletions.
4 changes: 2 additions & 2 deletions META6.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"CLI::Version:ver<0.0.7>:auth<zef:lizmat>",
"Edit::Files:ver<0.0.4>:auth<zef:lizmat>",
"has-word:ver<0.0.3>:auth<zef:lizmat>",
"highlighter:ver<0.0.12>:auth<zef:lizmat>",
"highlighter:ver<0.0.14>:auth<zef:lizmat>",
"JSON::Fast:ver<0.17>:auth<cpan:TIMOTIMO>",
"rak:ver<0.0.17>:auth<zef:lizmat>",
"rak:ver<0.0.18>:auth<zef:lizmat>",
"String::Utils:ver<0.0.8>:auth<zef:lizmat>",
"META::constants:ver<0.0.2>:auth<zef:lizmat>"
],
Expand Down
62 changes: 52 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ If <git blame> information can be obtained, then the associated `Git::Blame::Fil
$ rak '*.commits > 10' --blame-per-file --files-with-matches
```

Requires that the [`Git::Blame::File`](https://raku.land/zef:lizmat/Git::Blame::File) is installed.
Requires that the [`Git::Blame::File`](https://raku.land/zef:lizmat/Git::Blame::File) module is installed.

--blame-per-line
----------------
Expand All @@ -150,7 +150,7 @@ If <git blame> information can be obtained, then the associated `Git::Blame::Lin
$ rak '{ .author eq "Scooby Doo" }' --blame-per-line
```

Requires that the [`Git::Blame::File`](https://raku.land/zef:lizmat/Git::Blame::File) is installed.
Requires that the [`Git::Blame::File`](https://raku.land/zef:lizmat/Git::Blame::File) module is installed.

--blocks=condition
------------------
Expand All @@ -167,6 +167,11 @@ $ rak --find --blocks='* >= 3'

Indicate whether there should be a visible division between matches of different files. Can also be specified as a string to be used as the divider. Defaults to `True` (using an empty line as a divider) if `--group-matches` is (implicitly) set to `True`, else defaults to `False`.

--checkout=branch
-----------------

Only valid if the current directory is under git version control. Indicate the branch to checkout by the general matching logic of App::Rak. Will produce listing of matching branches if more than one, or say that there is no match. Branches need not have been checked out locally yet.

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

Expand Down Expand Up @@ -196,6 +201,11 @@ Indicate the number of worker threads that should be maximally. Defaults to the

If specified, indicates the `Callable` that should return True to include a file in the selection of files to be checked. The device number of the filesystem on which the file is located, will be passed as the only argument.

--dir=condition
---------------

If specified, indicates the `Callable` that should return True to have a directory be included for further recursions in file selection. The basename of the directory will be passed as the only argument. Defaults to all directories that do not start with a period. Can specify as a flag to include **all** directories for recursion.

--dryrun
--------

Expand Down Expand Up @@ -236,6 +246,11 @@ $ rak foo --extensions=

Predefined groups are `#raku`, `#perl`, `#c`, `#c++`, `#yaml`, <#ruby> `#python`, `#markdown` and `#text`.

--file=condition
----------------

If specified, indicates the `Callable` that should return True to have a file be included in the file selection process. The basename of the file will be passed as the only argument. Defaults to `True`, indicating that all files should be included.

--file-separator-null
---------------------

Expand Down Expand Up @@ -271,6 +286,11 @@ $ rak --find --filesize='* >= 30'

Flag. If specified with a true value, will **not** look at the contents of the selected paths, but instead consider the selected paths as lines in a virtual file.

--find-all
----------

Flag. If specified with a true value, will override any file or directory filter settings and include all possible files for inspection.

--first-only[=N]
----------------

Expand Down Expand Up @@ -388,12 +408,22 @@ Flag. Indicate whether the pattern should be highlighted in the line in which it
--highlight--after[=string]
---------------------------

Indicate the string that should be used at the end of the pattern found in a line. Specifying implies `--highlight`ing implicitely. If `--highlight` or `--highlight-before` are explicitely specified, will default to the empty string if `--matches-only` is specified with a `True` value, or whatever is specified with `--highlight-before`, or to the ANSI code to end **bold**.
Indicate the string that should be used at the end of the pattern found in a line. Specifying implies `--highlight`ing implicitely. If `--highlight` or `--highlight-before` are explicitely specified, will default to whatever is specified with `--highlight-before`, or to the ANSI code to end **bold**.

--highlight--before[=string]
----------------------------

Indicate the string that should be used at the end of the pattern found in a line. Specifying implies `--highlight`ing implicitly. If `highlight` is explicitely specified with a trueish value, will default to a space if `--matches-only` is specified with a `True` value, or to the terminal code to start **bold** otherwise.
Indicate the string that should be used at the end of the pattern found in a line. Specifying implies `--highlight`ing implicitly. If `highlight` is explicitely specified with a trueish value, will default to the terminal code to start **bold**.

--ignorecase
------------

Flag. If specified with a trueish value, indicates that any matching should be done case insensitively. Default is `False`.

--ignoremark
------------

Flag. If specified with a trueish value, indicates that any matching should be done without consideration of any accents. Default is `False`.

--inode=condition
-----------------
Expand Down Expand Up @@ -475,13 +505,13 @@ Flag. If specified with a trueish value, will only select files that can be exec

Flag. If specified with a trueish value, will only select files that can be read by anybody. Use negation `--/is-world-readable` to only select files that are **not** readable by anybody.

--is-world-writable File can (not) be written to by anybody
-----------------------------------------------------------
--is-world-writable
-------------------

Flag. If specified with a trueish value, will only select files that can be written to by anybody. Use negation `--/is-world-writable` to only select files that can **not** be written to by anybody.

--is-writable File can (not) be written to by owner
---------------------------------------------------
--is-writable
-------------

Flag. If specified with a trueish value, will only select files that can be written to by the current user. Use negation `--/is-writable` to only select files that can **not** be written to by the current user.

Expand Down Expand Up @@ -606,7 +636,7 @@ Indicate the Raku module that should be loaded. Only makes sense if the pattern
--matches-only
--------------

Flag. Indicate whether only the matched pattern should be produced, rather than the line in which the pattern was found. Defaults to `False`.
Flag. Indicate whether only the matched pattern should be produced, rather than the line in which the pattern was found. Defaults to `False`. Frequently used in conjunction with `--per-file`. Will show separated by space if multiple matches are found on the same line.

--output-file=filename
----------------------
Expand Down Expand Up @@ -654,6 +684,16 @@ Indicate the path of the file to read path specifications from instead of from a

Alternative way to specify the pattern to search for. If (implicitly) specified, will assume the first positional parameter specified is actually a path specification, rather than a pattern. This allows the pattern to be searched for to be saved with `--save`.

--per-file[=code]
-----------------

Indicate whether matching should be done per file, rather than per line. If specified as a flag, will slurp a file with the indicated `--encoding` and present that to the matcher. Optionally takes a `Callable` specification: this will be given an `IO::Path` object of the file: whatever it produces will be presented to the matcher. Usually used in conjunction with `--matches-only` and/or `count-only`.

```bash
# look for foo in only the first 10 lines of each file
$ rak foo --per-file='*.lines(:!chomp).head(10).join'
```

--quietly
---------

Expand Down Expand Up @@ -730,7 +770,9 @@ Only applicable if `--csv-per-line` has been specified. Indicates the character
--show-blame
------------

Flag. Indicate whether to show `git blame` information for matching lines if possible, instead of just the line. Defaults to `False`. **TEMPORARILY UNAVAILABLE**.
Flag. Indicate whether to show `git blame` information for matching lines if possible, instead of just the line. Defaults to `False`.

Requires that the [`Git::Blame::File`](https://raku.land/zef:lizmat/Git::Blame::File) module is installed.

--show-filename
---------------
Expand Down
7 changes: 7 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Ideas / Todo's
==============

- run a raku program and interpret the execution error as an --edit
- modified-after/before etc, instead of just modified etc.
- expose mapper
- create plugin structure
74 changes: 64 additions & 10 deletions doc/App-Rak.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ $ rak '*.commits > 10' --blame-per-file --files-with-matches

=end code

Requires that the L<C<Git::Blame::File>|https://raku.land/zef:lizmat/Git::Blame::File> is installed.
Requires that the L<C<Git::Blame::File>|https://raku.land/zef:lizmat/Git::Blame::File> module is installed.

=head2 --blame-per-line

Expand All @@ -189,7 +189,7 @@ $ rak '{ .author eq "Scooby Doo" }' --blame-per-line

=end code

Requires that the L<C<Git::Blame::File>|https://raku.land/zef:lizmat/Git::Blame::File> is installed.
Requires that the L<C<Git::Blame::File>|https://raku.land/zef:lizmat/Git::Blame::File> module is installed.

=head2 --blocks=condition

Expand All @@ -211,6 +211,13 @@ different files. Can also be specified as a string to be used as the
divider. Defaults to C<True> (using an empty line as a divider) if
C<--group-matches> is (implicitly) set to C<True>, else defaults to C<False>.

=head2 --checkout=branch

Only valid if the current directory is under git version control. Indicate
the branch to checkout by the general matching logic of App::Rak. Will
produce listing of matching branches if more than one, or say that there
is no match. Branches need not have been checked out locally yet.

=head2 --context=N

Indicate the number of lines that should be shown B<around> any line that
Expand Down Expand Up @@ -250,6 +257,14 @@ If specified, indicates the C<Callable> that should return True to include a
file in the selection of files to be checked. The device number of the
filesystem on which the file is located, will be passed as the only argument.

=head2 --dir=condition

If specified, indicates the C<Callable> that should return True to have a
directory be included for further recursions in file selection. The basename
of the directory will be passed as the only argument. Defaults to all
directories that do not start with a period. Can specify as a flag to
include B<all> directories for recursion.

=head2 --dryrun

Flag. Indicate to B<not> actually make any changes to any content
Expand Down Expand Up @@ -300,6 +315,13 @@ $ rak foo --extensions=
Predefined groups are C<#raku>, C<#perl>, C<#c>, C<#c++>, C<#yaml>, <#ruby>
C<#python>, C<#markdown> and C<#text>.

=head2 --file=condition

If specified, indicates the C<Callable> that should return True to have a
file be included in the file selection process. The basename of the file
will be passed as the only argument. Defaults to C<True>, indicating that
all files should be included.

=head2 --file-separator-null

Flag. Indicate to separate filenames by null bytes rather than newlines
Expand Down Expand Up @@ -340,6 +362,11 @@ Flag. If specified with a true value, will B<not> look at the contents of
the selected paths, but instead consider the selected paths as lines in a
virtual file.

=head2 --find-all

Flag. If specified with a true value, will override any file or directory
filter settings and include all possible files for inspection.

=head2 --first-only[=N]

Indicate the number of matches to show. If specified without a value, will
Expand Down Expand Up @@ -459,17 +486,25 @@ are explicitely specified, or C<False> otherwise.

Indicate the string that should be used at the end of the pattern found in
a line. Specifying implies C<--highlight>ing implicitely. If C<--highlight>
or C<--highlight-before> are explicitely specified, will default to the empty
string if C<--matches-only> is specified with a C<True> value, or whatever
or C<--highlight-before> are explicitely specified, will default to whatever
is specified with C<--highlight-before>, or to the ANSI code to end B<bold>.

=head2 --highlight--before[=string]

Indicate the string that should be used at the end of the pattern found in
a line. Specifying implies C<--highlight>ing implicitly. If C<highlight>
is explicitely specified with a trueish value, will default to a space if
C<--matches-only> is specified with a C<True> value, or to the terminal code
to start B<bold> otherwise.
is explicitely specified with a trueish value, will default to the terminal
code to start B<bold>.

=head2 --ignorecase

Flag. If specified with a trueish value, indicates that any matching should
be done case insensitively. Default is C<False>.

=head2 --ignoremark

Flag. If specified with a trueish value, indicates that any matching should
be done without consideration of any accents. Default is C<False>.

=head2 --inode=condition

Expand Down Expand Up @@ -571,13 +606,13 @@ Flag. If specified with a trueish value, will only select files that can be
read by anybody. Use negation C<--/is-world-readable> to only select files
that are B<not> readable by anybody.

=head2 --is-world-writable File can (not) be written to by anybody
=head2 --is-world-writable

Flag. If specified with a trueish value, will only select files that can be
written to by anybody. Use negation C<--/is-world-writable> to only select
files that can B<not> be written to by anybody.

=head2 --is-writable File can (not) be written to by owner
=head2 --is-writable

Flag. If specified with a trueish value, will only select files that can be
written to by the current user. Use negation C<--/is-writable> to only select
Expand Down Expand Up @@ -736,6 +771,8 @@ pattern is executable code.

Flag. Indicate whether only the matched pattern should be produced, rather
than the line in which the pattern was found. Defaults to C<False>.
Frequently used in conjunction with C<--per-file>. Will show separated by
space if multiple matches are found on the same line.

=head2 --output-file=filename

Expand Down Expand Up @@ -793,6 +830,22 @@ specified, will assume the first positional parameter specified is
actually a path specification, rather than a pattern. This allows
the pattern to be searched for to be saved with C<--save>.

=head2 --per-file[=code]

Indicate whether matching should be done per file, rather than per line.
If specified as a flag, will slurp a file with the indicated C<--encoding>
and present that to the matcher. Optionally takes a C<Callable>
specification: this will be given an C<IO::Path> object of the file:
whatever it produces will be presented to the matcher. Usually used in
conjunction with C<--matches-only> and/or C<count-only>.

=begin code :lang<bash>

# look for foo in only the first 10 lines of each file
$ rak foo --per-file='*.lines(:!chomp).head(10).join'

=end code

=head2 --quietly

Flag. Only makes sense if the pattern is a C<Callable>. If specified
Expand Down Expand Up @@ -883,7 +936,8 @@ character to indicate the field separator. Defaults to the B<comma>.

Flag. Indicate whether to show C<git blame> information for matching lines
if possible, instead of just the line. Defaults to C<False>.
B<TEMPORARILY UNAVAILABLE>.

Requires that the L<C<Git::Blame::File>|https://raku.land/zef:lizmat/Git::Blame::File> module is installed.

=head2 --show-filename

Expand Down
Loading

0 comments on commit 77668cd

Please sign in to comment.