out-of-cheese-error / the-way

A code snippets manager for your terminal.
MIT License
352 stars 16 forks source link

piping text into emacs with the-way #123

Closed jgarte closed 2 years ago

jgarte commented 2 years ago

I ran the following command with emacs:

:'<,'>!the-way view 14

My snippet was at index 14.

How can I avoid the ansi characters in the output?

^[[38;2;0;0;0m
^[[38;2;30;74;236m■ ^[[38;2;192;197;206m#14. guix package template ^[[38;2;192;197;206m| scheme ^[[38;2;101;115;126m:guix:package:
^[[38;2;0;0;0m
^[[38;2;192;197;206m(^[[38;2;192;197;206mdefine^[[38;2;192;197;206m-^[[38;2;192;197;206mpublic XXX
^[[38;2;192;197;206m  ^[[38;2;192;197;206m(^[[38;2;192;197;206mpackage
^[[38;2;192;197;206m    ^[[38;2;192;197;206m(^[[38;2;192;197;206mname ^[[38;2;192;197;206m"^[[38;2;163;190;140mXXX^[[38;2;192;197;206m"^[[38;2;192;197;206m)^[[38;2;192;197;206m
^[[38;2;192;197;206m    ^[[38;2;192;197;206m(^[[38;2;192;197;206mversion ^[[38;2;192;197;206m"^[[38;2;163;190;140mXXX^[[38;2;192;197;206m"^[[38;2;192;197;206m)^[[38;2;192;197;206m
^[[38;2;192;197;206m    ^[[38;2;192;197;206m(^[[38;2;192;197;206msource
^[[38;2;192;197;206m      ^[[38;2;192;197;206m(^[[38;2;192;197;206morigin XXX^[[38;2;192;197;206m)^[[38;2;192;197;206m)^[[38;2;192;197;206m
^[[38;2;192;197;206m    ^[[38;2;192;197;206m(^[[38;2;192;197;206mbuild^[[38;2;192;197;206m-^[[38;2;192;197;206msystem XXX^[[38;2;192;197;206m)^[[38;2;192;197;206m
^[[38;2;192;197;206m    ^[[38;2;192;197;206m(^[[38;2;192;197;206mhome^[[38;2;192;197;206m-^[[38;2;192;197;206mpage ^[[38;2;192;197;206m"^[[38;2;163;190;140mXXX^[[38;2;192;197;206m"^[[38;2;192;197;206m)^[[38;2;192;197;206m
^[[38;2;192;197;206m    ^[[38;2;192;197;206m(^[[38;2;192;197;206msynopsis ^[[38;2;192;197;206m"^[[38;2;163;190;140mXXX^[[38;2;192;197;206m"^[[38;2;192;197;206m)^[[38;2;192;197;206m
^[[38;2;192;197;206m    ^[[38;2;192;197;206m(^[[38;2;192;197;206mdescription ^[[38;2;192;197;206m"^[[38;2;163;190;140mXXX^[[38;2;192;197;206m"^[[38;2;192;197;206m)^[[38;2;192;197;206m
^[[38;2;192;197;206m    ^[[38;2;192;197;206m(^[[38;2;192;197;206mlicense XXX^[[38;2;192;197;206m)^[[38;2;192;197;206m)^[[38;2;192;197;206m)^[[38;2;0;0;0m
Ninjani commented 2 years ago

Ah good catch. I'll add a check to see if stdout is in tty mode otherwise use the plain output

jgarte commented 2 years ago

Ah good catch. I'll add a check to see if stdout is in tty mode otherwise use the plain output

Thank you!