soimort / translate-shell

:speech_balloon: Command-line translator using Google Translate, Bing Translator, Yandex.Translate, etc.
https://www.soimort.org/translate-shell
The Unlicense
6.94k stars 391 forks source link

escape codes with less pager #341

Closed aeosynth closed 3 years ago

aeosynth commented 4 years ago

less needs the -R / --RAW-CONTROL-CHARS option to display ansi escape codes correctly (the lowercase -r options display all escape codes and can confuse less). i'd like to use trans' -v option instead of manually piping into less -R.

brookskindle commented 4 years ago

You should be able to accomplish this by setting the PAGER environment variable or by using the -pager flag.

IE, these are all equivalent

$ trans es:en hola | less -R
$ PAGER="less -R" trans -v es:en hola
$ trans -v -pager "less -R" es:en hola
aeosynth commented 4 years ago

This issue is about improving the -v option so that we don't have to worry about specifying less -R.

brookskindle commented 4 years ago

Okay that's fair. I'm not a contributor on this project and I don't know what your specific use-case is, so I don't want to assume too much. For my use-case, I'm pretty happy with exporting the LESS and PAGER environment variables in my ~/.zshrc file as it allows me to use less in a color-friendly manner, regardless of the application calling it.

$ env | grep -e LESS -e PAGER
PAGER=less
LESS=-R

Good luck, hopefully your use-case can be addressed by one of the developers soon.

soimort commented 3 years ago

Thanks a lot for the suggestion!