Commit Graph

233 Commits

Author SHA1 Message Date
Harrison McCullough
67f1ff9c0e Add support for fixed strings and --less-search-pattern
Previously, if you tried to use the `-F`/`--fixed strings` option for ripgrep in
combination with the `--less-search-pattern` option, `less` would either a)
match a different pattern than intended, since it would be interpreted as a
regular expression, or b) refuse to start if it detected an invalid pattern.

This change keeps track of whether or not the `--fixed-strings` option was
passed in. If both it and the `--less-search-pattern` was passed in, a `^R`
(Control-R) control character is prepended to the search pattern. This instructs
less to *not* treat the pattern as a regular expression.
2020-01-17 11:05:06 -05:00
Harrison McCullough
cf7b33443a Add --less-search-pattern option to tell less to search for pattern
The `less` pager can search for a pattern. In addition, you can instruct it to
search for a given pattern on startup by passing in the `-p` flag followed by
the pattern to search for. Since the `batgrep` command is searching for a
pattern and invoking the pager, it has the opportunity to take advantage of this
functionality.

This patch adds a `-p` flag to `batgrep` which, in turn, passes `-p $PATTERN` to
the pager invoked. This may be specific to `less`, which is
unfortunate. However, it doesn't seem like there would be a convenient way to
make this more general. In addition, most pagers forward the actual paging to
`less` anyways.

To clarify that the behavior is specific to `less`, the long name is
`--less-search-pattern`.
2020-01-17 10:25:38 -05:00
Ethan P
eca97339e0
Fix inconsistencies in tests between tty and script 2019-12-25 00:17:01 -08:00
Ethan P
98e2077fe2
Fix lib.pager test breaking on CI 2019-12-23 18:06:27 -08:00
Ethan P
b98e241fca
Update CI environment to have script command 2019-12-23 17:49:34 -08:00
Ethan P
08acea3bf4
Add test for pager lib 2019-12-23 17:45:58 -08:00
Ethan P
285ac66303
Fix missing pager arguments in batman.sh 2019-12-23 17:08:32 -08:00
Ethan P
18bf6e2c5c
Add argument forwarding from batgrep to ripgrep 2019-12-23 16:58:58 -08:00
Ethan P
f17681b8b8
Update batgrep documentation 2019-12-23 16:50:56 -08:00
Ethan P
a3483a658a
Add support for '--smart-case' to batgrep 2019-12-23 16:49:31 -08:00
Ethan P
e967497387
Update batman.sh to use the pager.sh library script 2019-12-23 16:39:33 -08:00
Ethan P
7cabaa620d
Fix batman.sh incorrectly disabling the pager 2019-12-23 16:20:28 -08:00
Ethan P
8339354189
Update build.sh to fix output messages 2019-10-27 00:14:55 -07:00
Ethan P
f740dc86d2
Update docs for batwatch 2019-10-25 13:54:45 -07:00
Ethan P
767cfb59b0
Update batwatch to use print_error function 2019-10-25 13:52:44 -07:00
Ethan P
80a07980aa
Add "poll" watcher to batwatch 2019-10-25 13:50:10 -07:00
Ethan P
a0fcb97ff9
Disable batman tests because man will not read local files 2019-10-22 16:06:44 -07:00
Ethan P
14b69a893d
Add new tests for batman 2019-10-22 15:42:34 -07:00
Ethan P
df14cfc8b1
Add way to see test snapshot output 2019-10-22 15:42:06 -07:00
Ethan P
d9e34e2d5f
Add color option to batman 2019-10-22 15:35:10 -07:00
Ethan P
fa8a3bb850
Improve tests 2019-10-22 15:21:12 -07:00
Ethan P
763d34d9c9
Fix LIB variable 2019-10-22 15:04:34 -07:00
Ethan P
c2b4d2fe9a
Add CI test to see if symlinks work 2019-10-22 15:00:35 -07:00
Ethan P
0aeabe9bdf
Fix broken build when missing shfmt 2019-10-22 10:51:56 -07:00
Ethan P
358632ed9d
Add experimental compression 2019-10-11 13:03:47 -07:00
Ethan P
2a8de58809
Add unimplemented extra minification 2019-10-11 12:30:06 -07:00
Ethan P
93843cd067
Fix missing file name in batwatch 2019-10-11 12:18:43 -07:00
Ethan P
0621d14951
Add ClangFormat to prettybat 2019-09-26 18:02:21 -07:00
Ethan P
24313f8281
Fix broken error message in batwatch 2019-09-26 16:10:42 -07:00
Ethan P
d7cd12ed4f
Add batwatch documentation 2019-09-26 16:09:19 -07:00
Ethan P
33ebf07bbd
Update batwatch to show errors outside the pager 2019-09-26 16:08:44 -07:00
Ethan P
a63609e173
Add build status to README 2019-09-26 16:00:02 -07:00
Ethan P
3e399294e2
Change tests to not show failure reasons in build script 2019-09-26 15:57:17 -07:00
Ethan P
8adaae9f2c
Remove auto-verification tests in CI builds 2019-09-26 15:50:58 -07:00
Ethan P
efbf911f82
Add verification to build script 2019-09-26 15:49:36 -07:00
Ethan P
7e4d8257fd
Fix build for files that try to source opt_hooks 2019-09-26 15:42:52 -07:00
Ethan P
e9f2b244a8
Add batwatch to readme 2019-09-26 15:40:11 -07:00
Ethan P
0309ceb054
Fix inline docs for version.sh lib 2019-09-26 15:37:11 -07:00
Ethan P
e02d0666f3
Add batwatch script 2019-09-26 15:36:38 -07:00
Ethan P
a472f1c651
Refactor common messages into functions 2019-09-25 15:59:54 -07:00
Ethan P
12bf16b199
Add more preprocessing variable replacements 2019-09-25 14:48:52 -07:00
Ethan P
9c10ef4871
Refactor common options into opt hooks 2019-09-25 14:48:21 -07:00
Ethan P
d776b7acbc
Misc fixes for code formatting/style 2019-09-25 13:20:36 -07:00
Ethan P
e15b9d439a
Update tests for lib/opt.sh 2019-09-25 13:19:51 -07:00
Ethan P
6e8959b1d6
Fix $PROGRAM variable not taking the program name 2019-09-25 13:16:29 -07:00
Ethan P
a1cf0eca18
Update documentation for batgrep 2019-09-24 12:11:54 -07:00
Ethan P
e71de135e6
Add experimental pager support to batgrep 2019-09-24 12:10:17 -07:00
Ethan P
c8e22890fe
Update batgrep to disabled highlights when -C=0 2019-09-18 21:12:23 -07:00
Ethan P
daa54ba4cf
Update batgrep to allow snip to be disabled 2019-09-18 14:20:04 -07:00
Ethan P
7537354fdf
Update documentation to add install instructions for each script 2019-09-18 14:15:45 -07:00