pomdtr / sunbeam

Elevate Your Command Line Experience.
https://sunbeam.sh
MIT License
272 stars 12 forks source link

Issue with color and Markdown formatting in rc.46 #74

Closed b-per closed 8 months ago

b-per commented 8 months ago

Trying out the tldr extension and I am getting the following code showing for cat

   [1m[39mcat [22m[39m [39mPrint and concatenate files.[22m[39m [39mMore information: https://keith.github.io/xcode-man-
   pages/cat.1.html.[22m[39m [32m

   • Print the contents of a file to  stdout :[22m[39m
   [31m    cat [22m[39m[34mpath/to/file[39m[31m[22m[39m
   [32m
   • Concatenate several files into an output file:[22m[39m
   [31m    cat [22m[39m[34mpath/to/file1 path/to/file2 ...[39m[31m > [22m[39m[34mpath/to/output_file[39m[31m[22m[39m
   [32m
   • Append several files to an output file:[22m[39m
   [31m    cat [22m[39m[34mpath/to/file1 path/to/file2 ...[39m[31m >> [22m[39m[34mpath/to/output_file[39m[31m[22m[39m
   [32m
   • Copy the contents of a file into an output file without buffering:[22m[39m
   [31m    cat -u [22m[39m[34m/dev/tty12[39m[31m > [22m[39m[34m/dev/tty13[39m[31m[22m[39m
   [32m
   • Write  stdin  to a file:[22m[39m
   [31m    cat - > [22m[39m[34mpath/to/file[39m[31m[22m[39m
   [32m
   • Number all output lines:[22m[39m
   [31m    cat -n [22m[39m[34mpath/to/file[39m[31m[22m[39m
   [32m
   • Display non-printable and whitespace characters (with  M-  prefix if non-ASCII):[22m[39m
   [31m    cat -v -t -e [22m[39m[34mpath/to/file[39m[31m[22m[39m

I tried it both in the Warp terminal and in the VSCode one

pomdtr commented 8 months ago

strange I'm not able to reproduce the bug. Does it only happen in the cat command ?

b-per commented 8 months ago

It was for all commands. I managed to get to the bottom of it though :-)

My issue was that I had tldr the https://tldr.sh/ version and not tldr the tealdeer rust version. The first version doesn't have a --raw option and was returning colored text.

Long story short, I fixed it with brew remove tldr and brew install tealdeer

pomdtr commented 8 months ago

I should probably just strip color codes from the command output, thanks for the explanation.