./textproc/hgrep, Grep with human-friendly search output

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]


Branch: CURRENT, Version: 0.2.1, Package name: hgrep-0.2.1, Maintainer: pin

hgrep is a grep tool to search files with given pattern and print the matched
code snippets with human-friendly syntax highlighting.
In short, it's a fusion of bat and grep or other alternatives like ripgrep.

This is similar to -C option of grep command, but hgrep focuses on human
readable outputs. hgrep is useful to survey the matches with contexts around
them.
When some matches are near enough, hgrep prints the lines within one code
snippet. Unlike grep -C, hgrep adopts some heuristics around blank lines to
determine efficient number of context lines.

As an optional feature, hgrep has builtin grep implementation thanks to ripgrep
as library. It's a subset of rg command. And it's faster when there are so many
matches since everything is done in the same process.


Master sites:

Filesize: 827.463 KB

Version history: (Expand)


CVS history: (Expand)


   2021-11-14 10:06:41 by pin | Files touched by this commit (3) | Package updated
Log message:
textproc/hgrep: update to 0.2.1

-Heuristic algorithm to choose the foreground color of matched regions was
 improved. Now hgrep generates multiple candidates for the foreground color,
 and chooses one of them looking at the color distances from the background
 color.
-Add new Material theme. It is a very popular low-contrast color theme. Try it
 by hgrep --theme Matrial.
-Add new Carbonight theme. It is a minimal monotone color theme. Some people
 feel that too colorful outputs are hard to see. This color theme might fit to
 such people.
-Built-in grep allows K/M/G suffix at --max-filesize option to specify a file
 size easily.
-Built-in grep adds new flag --invert-match for invert matching. It shows lines
 that do not match the given pattern.
-Built-in grep adds new flag --one-file-system. When enabled, the search will
 not cross file system boundaries relative to where it started from.
-Built-in grep adds new short flag-. as alias of long flag --hidden.
-Built-in grep adds new flag --no-unicode which disables Unicode-aware search.
-Built-in grep improves the output from --type-list. Now types are printed in
 bold texts which is easier to see.
-Syntax assets were updated to the latest. They improve some syntax highlight
 detection (for example, vimrc for Vim files) and solve some highlighting
 issues.
-Fix a broken pipe error when hgrep command is piped to a pager command like
 less. This happened when less exits earlier than hgrep command, for example,
 when you immediately quit a pager by q without scrolling the output to the end.
 In the case, hgrep still tried to output the result to stdout even if the pipe
 had already been closed and it caused a broken pipe error. In v0.2.1, hgrep
 correctly ignores such broken pipe errors.
-Fix --no-wrap deprecated flag was not removed at v0.2.0. Use --wrap instead if
 you used the flag.
-Fix checksum of downloaded package via Homebrew on arm64 macOS.
-Fix --type-list flag did not print types when a pattern argument is not given.
-(Dev) Move asset-builder tool directory to assets/builder.
-(Dev) The script to update test snapshots is now 25x faster.
-(Dev) CI job to run clippy and rustfmt is now 6x faster.
   2021-11-06 23:47:51 by pin | Files touched by this commit (3) | Package updated
Log message:
textproc/hgrep: update to 0.2.0

-BREAKING The default printer is now syntect. It has the following benefits.
 I tested it for several weeks and it seems stable. See the section in README
 to know the difference between bat printer and syntect printer.
  -Performance is 2x to 4x faster
  -Output layout and highlighting are optimized; line number highlight and
  matched regions at matched line
  -Support background color with --background
  -Color themes are optimized
-BREAKING The default value of --min-context was changed from 5 to 3. And the
 default value of --max-context was changed from 10 to 6. This is because it
 turned out that the previous default values were too large for surveying the
 search results.
-BREAKING Since themes for syntect printer are now managed by ourselves
 (see below), syntect printer no longer looks at BAT_THEME and BAT_STYLE
 environment variables. To set the default theme and layout, use shell's
 command alias. See the document for more details.
-syntect printer now renders more accurate colors by considering alpha values
 of colors by blending them with background colors. In v0.1.9, alpha values
 were simply ignored. For example, gutter color with Nord theme was wrongly
 very light at v0.1.9.
-Depend on ansi_term crate only when targeting Windows. It reduces number of
 dependencies when bat-printer is not enabled.
-Improve a compile error when both feature syntect-printer and bat-printer are
 disabled.
-Describe the exit status of hgrep command and versioning of this project in
 the readme document.
-Fix rendering ansi theme was broken. The theme is for old terminals which
 only supports 16 colors.
-Fix --first-only did not work with bat printer.
-Fix the background color in file header when --background is specified
   2021-11-01 21:39:24 by pin | Files touched by this commit (3) | Package updated
Log message:
textproc/hgrep: update to 0.1.9

-Support multiple regions highlighting. In v0.1.8, matched region highlighting
was added but it only highlighted the first match in the line. Now all matched
regions are highlighted. Note that region highlighting is available when using
hgrep in combination of syntect-printer and ripgrep features.
-Add --ascii-lines flag for terminals which does not support rendering unicode
characters well. With this flag, unicode characters like '│' or '─' are replaced
with ASCII characters '|' or '-'. This feature is only supported by
syntect-printer (use -p syntect).
-Add --first-only (-f) flag to show only the first snippet per file. This is
useful when you want to look around the results.
-Fallback to a minimap border color when no gutter background color is found.
-Reduce number of redundant color codes output to stdout by about 21.5% in test
cases. This also improves performance by about 6%. See the commit for details.
-Performance of built-in grep was improved 20~80% when there are so many files
to search. Previously the implementation collected all paths before searching a
pattern in them, but with this improvement, the paths are now streamed.
See the commit for details.
-Use mimalloc as global allocator for better performance. This improves
performance by 0~55% in our benchmarks. See the commit for details.
-(Dev) Running unit tests is about 8.5x faster by caching assets for syntax
highlighting.
   2021-10-27 20:49:43 by pin | Files touched by this commit (3) | Package updated
Log message:
textproc/hgrep: update to 0.1.8

-syntect-printer supports text-wrapping. Longer lines than terminal width are
now wrapped by default. It can handle wide characters including special emojis
with zero-width joiner (U+200D)
-syntect-printer highlights matched regions in matched lines with a searched
text color. Since match positions in matched lines are not included in output
from grep -nH, currently this is only supported by combination of
syntect-printer feature and ripgrep feature
-syntect-printer now uses light dashed lines for the separator of snippets
-Add --wrap MODE option where MODE is one of char or never (the default value
is char). More modes may be implemented in the future
-In favor of --wrap option, --no-wrap flag is now deprecated and will be
removed at v0.2.0. Use --wrap never instead
-When building binaries for Windows, link C runtime statically. This avoid
depending on vcruntime DLL at runtime
-Critical section of syntect-printer was optimized. It slightly improved
performance (around 4% faster in benchmarks)
-Enable thin LTO for release build. It slightly improved performance
(0~6% faster in benchmarks)
   2021-10-25 00:02:29 by pin | Files touched by this commit (3) | Package updated
Log message:
textproc/hgrep: update to 0.1.7

v0.1.7
-Fix highlighting was broken on 256 colors terminals when using bat-printer.
-bat-printer enables text wrapping by default as bat command does. --no-wrap
 can disable text wrapping.
-bat-printer now looks at bat's cache directory when --custom-assets flag is
 given. This is useful if you use some custom syntax highlighting or theme.
 Note that this may not work fine with some versions of bat command.
-bat-printer automatically uses 'ansi' theme for terminals which enable only
 16 colors since other themes don't work.
-Add --terminal-width option to give the width of terminal explicitly. This is
 useful when piping the results to other command like less.
-Fix build failure due to lack of assets (#4).
-Fix some newlines were missing when printing results with syntect-printer.
-Use terminal_size crate directly instead of using console crate. It removes
 3 dependencies when bat-printer feature is not enabled.
-The document has been improved. Especially if you like a pager such as less,
 I recommend to check 'Set default command options' section.
-(Dev) Several tests and benchmarks for syntect-printer were added.

v0.1.6
-Add new experimental syntect-printer feature built with syntect library.
 -It is much faster than current printer built on bat (2x~4x faster).
 -Its output layout is optimized for our use case. For example, line numbers at
 matches are highlighted in different color.
 -It supports painting background colors with --background flag. This is useful
 when your favorite theme does not fit to your terminal's background color.
 -See bat printer v.s. syntect printer section for comparison of the two
 printers.
-Add --printer (-p) flag to specify printer to use. It takes argument bat or
syntect. -p syntect enables the new experimental printer
-bat printer is now optional through bat-printer feature gate. Note that at
least bat-printer or syntect-printer must be enabled. Both printers are enabled
by default. See Feature flags section for more details.
-hgrep is now available for NetBSD. See the instruction (thanks @0323pin, #3)
   2021-10-20 14:27:49 by pin | Files touched by this commit (5)
Log message:
textproc/hgrep: import package

hgrep is a grep tool to search files with given pattern and print the matched
code snippets with human-friendly syntax highlighting.
In short, it's a fusion of bat and grep or other alternatives like ripgrep.

This is similar to -C option of grep command, but hgrep focuses on human
readable outputs. hgrep is useful to survey the matches with contexts around
them.
When some matches are near enough, hgrep prints the lines within one code
snippet. Unlike grep -C, hgrep adopts some heuristics around blank lines to
determine efficient number of context lines.

As an optional feature, hgrep has builtin grep implementation thanks to ripgrep
as library. It's a subset of rg command. And it's faster when there are so many
matches since everything is done in the same process.