Closed hellerve closed 3 years ago
That would be great!
There's a hardcoded path to pygmentize in maybe-highlight.
This "which" function in CL might help: https://github.com/eudoxia0/which/blob/master/src/which.lisp
Ah, I was meaning to use *pygmentize*
there, my bad. I think the user could use which
if they need to, but since they’re required to provide the path themselves we don’t need to figure it out!
It works fine. Nice.
Now for a better experience out of the box, I would mention "which" (I like it, it found my pygmentize in a virtual environment), add a "-h" command line argument, add a "--color" one,… this makes sbcli grow, but not necessarily by much. CLI arguments are stored in sb-ext:*posix-argv*
. No need of "real" CLI args parsing yet.
All fair points. Would --color
use which
to fill *pygmentize*
automatically? Or would setting it add another layer of enabling/disabling coloring?
indeed it could. The "do what I mean" behavior for me is:
*pygmentize*
is set, then sbcli always uses it (--color or not) (so there could be a --no-color
)--colors
, then it tries to find it (with "which", probably)(we can also first mention "which" in the README as a nice trick, and do the rest in a following commit)
I added the note for now, and will merge as-is. If we need which
capabilites later on, we know where to look! Thanks again!
This PR adds optional syntax highlighting by shelling out to pygmentize. I don’t love that approach, but it is pretty simple, and I didn’t want to go through the pains of doing syntax analysis myself for now.
Cheers