-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fish
shell's --help
command is not highlighted
#26
Comments
Thanks for reporting this @KaBankz! Unfortunately, this kind of help message is intractable for `cmd-help`.
It seems like `fish`'s help message uses overstrike formatting [1]. Notice in the copypasted help message how some lines have lots of
char X + mystery char ? + char X again
I'm guessing the unknown char is a backspace, which checks out with how this combination is represented as a bold char X (see the screenshots).
It'd be super complicated to handle this with a sublime syntax, so I decided early on [2] that `cmd-help` wouldn't cover this use case...
I appreciate your reporting this in any case! Also, if `cmd-help` was useful to you please give it a star!
1. https://unix.stackexchange.com/a/118709/545324
2. 055fe34
|
Unfortunate for fish, but thanks anyway for this cool tool, it's made my help usage much more pleasant. |
Hi @KaBankz ! I've given this another look and maybe we can strip special characters from the input before it reaches the syntax. Can you try running this? fish --help | sed -r "s,\x1B\[[0-9;]*[mK],,g" | bat -plhelp You could later put that If it works, I'll probably add it to the suggested configuration in the docs. That particular sed command comes from this StackOverflow answer. If you're on a BSD system (e.g.: MacOS), you may need to try this one. |
Hey @victor-gp, The I did some digging myself and no luck, but then I decided to ask ChatGPT, and low and behold, it gave me: sed 's/.\x08//g'
This seems to work perfectly to convert the overstriking formatted output to plaintext Before: fish - the friendly interactive shell
f�fi�is�sh�h [_�O_�P_�T_�I_�O_�N_�S] [_�F_�I_�L_�E [_�A_�R_�G ...]]
f�fi�is�sh�h [_�O_�P_�T_�I_�O_�N_�S] [-�-c�c _�C_�O_�M_�M_�A_�N_�D [_�A_�R_�G ...]] After: fish - the friendly interactive shell
fish [OPTIONS] [FILE [ARG ...]]
fish [OPTIONS] [-c COMMAND [ARG ...]] Now using it with fish --help | sed 's/.\x08//g' | bat -lhelp Although some nested stuff is not highlighted and some flags are highlighted while others are not, not sure if this is expected behavior or a bug: (sorry for the obnoxious arrows) Other than that, this solution seems to work perfect for fish! TL;DR 🎉 This work's for
|
description
The fish shell's help command output is not highlighted at all.
When piping into bat:
Regular:
$ bat --version
bat 0.24.0
$ fish --help
$ fish --version
3.7.1
The text was updated successfully, but these errors were encountered: