diff --git a/docs/kittens/hyperlinked_grep.rst b/docs/kittens/hyperlinked_grep.rst index f796229a7..bb75294cb 100644 --- a/docs/kittens/hyperlinked_grep.rst +++ b/docs/kittens/hyperlinked_grep.rst @@ -53,3 +53,9 @@ actions, :doc:`see here <../open_actions>`. Hopefully, someday this functionality will make it into some `upstream grep `_ program directly removing the need for this kitten. + + +.. note:: + While you can pass any of ripgrep's comand line options to the kitten and + they will be forwarded to rg, do not use options that change the output + formatting as the kitten works by parsing the output from ripgrep. diff --git a/kittens/hyperlinked_grep/main.py b/kittens/hyperlinked_grep/main.py index 45e9149a5..c840518c1 100644 --- a/kittens/hyperlinked_grep/main.py +++ b/kittens/hyperlinked_grep/main.py @@ -25,7 +25,7 @@ def write_hyperlink(write: Callable[[bytes], None], url: bytes, line: bytes, fra def main() -> None: if not sys.stdout.isatty() and '--pretty' not in sys.argv: os.execlp('rg', 'rg', *sys.argv[1:]) - cmdline = ['rg', '--pretty'] + sys.argv[1:] + cmdline = ['rg', '--pretty', '--with-filename'] + sys.argv[1:] p = subprocess.Popen(cmdline, stdout=subprocess.PIPE) assert p.stdout is not None write: Callable[[bytes], None] = cast(Callable[[bytes], None], sys.stdout.buffer.write)