Commit Graph

74 Commits

Author SHA1 Message Date
Ethan P
65a2f7561e
lib: Update option parser to better support short options 2020-10-29 01:24:32 -07:00
Ethan P
0f6529a0d8
batdiff: Make --all default behavior for no arguments 2020-10-28 19:40:35 -07:00
Ethan P
a6a1e55522
batgrep: Remove hardcoded reference to ripgrep executable 2020-10-28 19:19:51 -07:00
Ethan P
b5cb20cb23
batgrep: Allow searching through STDIN (#42) 2020-10-28 18:10:17 -07:00
Ethan P
5f5023d056
batgrep: Add simple parsing of RIPGREP_CONFIG_PATH. 2020-10-02 20:09:00 -07:00
Ethan P
dc50f28480
batgrep: Prevent RIPGREP_CONFIG_PATH context from breaking batgrep. 2020-10-02 19:58:41 -07:00
Ethan P
fa58888298
bat-modules: Add --modules-file option 2020-07-06 18:15:01 -07:00
Ethan P
df5b237273
batgrep: Add short flag number parsing for context options 2020-07-06 18:03:47 -07:00
Ethan P
38f56c1bc7
batwatch: Split hook_help into a lib script 2020-07-06 17:49:29 -07:00
Ethan P
69d9c38326
batwatch: small formatting changes 2020-07-06 17:43:37 -07:00
Alissa Huskey
990a1dc397 Minor refactor
- Use read to split on space between name and flags instead of paramater
  expansion.
2020-07-06 17:36:03 -07:00
Alissa Huskey
57be774f88 Fix gnu stat flag
- fix gnu stat formatting option from %z to %Z
- use read with a one second timeout instead of sleep, then quit if user
  responds with "q" (for testing, mostly)
- call pager_exec on entr and bat line instead of main so that --clear
  works
2020-07-06 17:36:03 -07:00
Alissa Huskey
4c09718a46 batwatch changes to reveal a bug and add --help
- Add `-h` and `--help` flags to print out basic usage.
- Refactor determine_stat_variant so that it checks to make sure the
value from `stat` is a epoch timestamp, and exit noisily if it is not.
- Change `determine_watcher` to set the `OPT_WATCHER` global directory
directly instead of echoing it then being called from a subshell. There
was an errror that the subshell was obscuring.
- Add a test to reflect the bug.
2020-07-06 17:36:03 -07:00
Ethan P
149f47fa66
Fix typo 2020-07-01 18:23:40 -07:00
Ethan P
6052d6ee17
batdiff/lib: Fix hardcoded git executable name (#35)
Thanks to @lilyball for pointing it out.
2020-06-17 17:53:20 -07:00
Ethan P
d5fa65132d
lib: Remove opt_hooks.sh and edit scripts to source lib files directly 2020-04-30 22:11:36 -07:00
Ethan P
4ee7451532
batman: Forward paging options to bat instead of handling them 2020-04-30 20:21:08 -07:00
Ethan P
b2bc772ad1 batgrep/batwatch: Update to use terminal width opt hook instead of tput cols 2020-04-27 18:51:36 -07:00
Ethan P
ab0f1b96d6 batdiff: Add batdiff script 2020-04-27 18:51:36 -07:00
Ethan P
0d73f2abd5
prettybat: Add support for GraphQL via Prettier 2020-04-27 02:14:34 -07:00
Ethan P
865c8b252b
prettybat: Add support for bat 0.14.0 --file-name option 2020-04-27 02:08:34 -07:00
Ethan P
7fa1faf7bf
bat-modules: Add working but work-in-progress code 2020-04-17 02:40:52 -07:00
Ethan P
c5927f72af
bat-modules: Start work on bat-modules script 2020-04-17 01:58:59 -07:00
Ethan P
03971fe64e
Split hooks into separate files to reduce compiled size 2020-04-08 03:19:58 -07:00
Ethan P
a91ee96e6a
Update scripts to use $EXECUTABLE_BAT instead of $BAT 2020-04-08 03:15:02 -07:00
Ethan P
a3d2df5927
Update all scripts to use constants, add --version support 2020-04-08 03:00:04 -07:00
Ethan P
f8d6dc83f3
prettybat.sh: Convert debug print to option 2020-04-01 12:56:29 -07:00
Ethan P
e48f1b5926
Fix more shellcheck warnings 2020-04-01 12:49:55 -07:00
Ethan P
07c2cabc81
Fix small formatting and logic regressions 2020-04-01 12:47:21 -07:00
Éfrit
f4765bfa54 Fix most of the errors and warnings reported by shellcheck 2020-04-01 02:55:41 +02:00
Éfrit
73aafa56e1 Format with vs-shell-format 2020-04-01 02:55:41 +02:00
Ethan P
5cbbbb6ebc
batman: Add support for MANPAGER environment variable 2020-02-15 15:10:18 -08:00
Ethan P
765658c23d
Fix regression caused by attempted fix of #6 2020-01-21 14:10:14 -08:00
Ethan P
c74d47ecd0
Attempt fix for #6 2020-01-21 09:57:55 -08:00
Ethan P
ab38bb254c
Fix incorrect width being passed to 'bat' in batgrep with pager 2020-01-17 20:52:58 -08:00
Ethan P
72b09b4416
Fix pager_name to print name of unknown pagers 2020-01-17 20:50:26 -08:00
Ethan P
c78bb6d592
Fix boolean conditional branching 2020-01-17 20:42:18 -08:00
Ethan P
3e9969de76
Add message for --search-pattern and no pager
I should probably find a more elegant way to split
an error message across multiple lines in the future.
2020-01-17 20:39:32 -08:00
Ethan P
63a9929592
Merge branch 'master' into search-pattern 2020-01-17 20:30:43 -08:00
Harrison McCullough
0cda564175 Make changes according to feedback
Most of these are simple changes. I added an `is_pager_less` and a `get_pager`
function to `pager.sh`. In order for this function to be available for use
inside `pager.sh`, I had to define the functions before setting defaults.

The `is_pager_less` function is then used for the `--search-pattern` to see if
the `$SCRIPT_PAGER` supports the `--search-pattern` flag. Right now, the only
supported pager is `less`.
2020-01-17 23:09:59 -05:00
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
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
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
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
d9e34e2d5f
Add color option to batman 2019-10-22 15:35:10 -07:00