Closed ciscohack closed 1 year ago
one more thing this help section also seems showing the wrong switch like it showing (-style) but if I am correct it should be (--style)
Works for me with moar
v1.17.0
in the macOS terminal.
echo $MOAR
say?echo $TERM
say?moar --style=gruvbox moar.go
:
moar moar.go
:
one more thing this help section also seems showing the wrong switch like it showing (-style) but if I am correct it should be (--style)
Both flags are accepted and correct, -style
is just printed by default. See this link for reference.
@walles @m3tav3rse Thanks for your comment and input. I don't know why but it's not working for me
John here is output of value you requested
If you have MOAR=--style=gruvbox
and run these two commands, then both of them will use the Gruvbox theme:
moar --style=gruvbox moar.go
moar moar.go
moar --style=igor
vs moar --style=gruvbox
?here is the output of commands
moar --style=igor asa.log
moar --style=gruvbox asa.log
There is no highlighting for .log
files, so the theme doesn't matter.
Ref: https://github.com/walles/moar/issues/128#issuecomment-1453754629
I didn't get it. Do you mean to say the style color only works with programming files and for the rest other file types like txt and log, use the terminal color. but BAT has no such limit.. it can render color style for any file whatever I choose But yes syntax highlight will work only for programming files. I expect same with moar ... request you to add this if missing
Not asking to highlight syntax through BAT support but at least color change for file I parse in moar
[BAT] can render color style for any file whatever I choose But yes syntax highlight will work only for programming files
"Syntax highlight" is what moar provides through Chroma (I think).
But what is "color style"? And how is that different from syntax highlight?
Maybe if you have a screenshot of what you'd expect then that could clarify this?
so I thought suppose my terminal theme is Gruvbox but when I read and log file through moar then it uses Dracula color rendering so thought color style is the option to do so..BAT do this for me.
Like this example the terminal theme is Solarize but BAT theme is gruvbox and rendering is also like gruvbox
now here same file in moar
What command line did you use to get this?
That's a shell script, and if it's named whatever.sh
then moar
should highlight it.
Ran command moar .exports and bat .exports in kitty terminal . As I said I already tested all combo before raising ticket moar is not working as I received whereas BAT is working fine
I experimented a bit and it seems like bat
looks at the contents of the file to identify its MIME type, whereas moar
just looks at the file name.
Sort of related to #134.
It might be possible to have moar
use DetectContentType()
as a fallback to determine the MIME type if the file name based detection fails.
This would likely fix the .exports
highlighting, but it would not do anything for the asa.log
highlighting that you mentioned above: https://github.com/walles/moar/issues/159#issuecomment-1741984095
hmm okay thanks John
But DetectContentType
seems pretty limited:
https://cs.opensource.google/go/go/+/refs/tags/go1.21.1:src/net/http/sniff.go;l=65-195
This one seems broader, but doesn't detect shell scripts: https://github.com/gabriel-vasile/mimetype
Same for this one, doesn't detect shell scripts: https://github.com/h2non/filetype
This one has native dependencies, making it impractical: https://github.com/rakyll/magicmime
Other suggestions welcome, none of the above are usable for this out of the box unfortunately.
This one seems nice, but requires the user to have Tensorflow installed, which I assume most people don't: https://github.com/robherley/guesslang-go
@walles Thanks a lot my friend for all your support and time on this. Yes, many and even I don't like 10 other dependencies installed to run 1 software. That's ok you can leave I use BAT for such needs as
Yet another candidate that doesn't recognize shell scripts: https://github.com/zRedShift/mimemagic
@walles it's not about shell script i feel scripts anyway moar is able to recognize
What text file formats would be important for you?
txt and log these are 2 most common type
Neither of those have any highlighting, so even if they were detected correctly they wouldn't receive any highlighting anyway.
@walles there is highlight for log in BAT but point is not about highlight..seems you not getting the request fully I said suppose my terminal theme is solarize and want my moar to render any log in color of gruvbox .. I gave you the screenshot above for very same comparision
Do you mean that the text of the log should have some certain color based on the theme (gruvbox)?
@walles just noticed the screenshot and understands the requirement. below SS my terminal theme is Solarize dark and when I ran bat
Whereas when I ran same thing in moar in second SS. You will see it used the Solarize theme colour style only for text though I have color style gruvbox chosen in moar
With gruvbox color style in BAT:--
With gruvbox color style in moar:--
Ideally when I choose the color style gruvbox in moar then color of text should be little yellowish as in first screenshot. Now I hope you understand the requirement
After cbbdaf632b322eadd915ba9659f873f8213d64f1, just released with v1.18.1, this should now work on 256 color terminals as well.
@walles you said that 1.8.0 will have syntax highlights like bat to some extent for log/text files like in bat screenshot above but I don't see it ..
Try v1.18.1.
ok thanks, waiting for the release update to be available
@walles just upgraded to 1.18.1 but the result is not what asked second I don't know what changes you did but anyway thank you so much for all your hard work
If you want real highlighting of .log
files you have to request it here:
https://github.com/alecthomas/chroma/issues
After it's implemented there then moar
can be upgraded.
Here's what moar --style=gruvbox /etc/services
does with moar 1.18.1. Notice how the color of text is a little yellowish for this unknown-format file. Was that not what you asked for in https://github.com/walles/moar/issues/159#issuecomment-1744124203?
@walles now try Dracula and cappuccino-macchiato style and see what moar color is rendering.. you can see the below SS output moar is producing totally different style
moar --style=catppuccin-macchiato new\ 219.txt
I'll need to bump Chroma to a newer version for this, the catppuccin themes were updated in July: https://github.com/alecthomas/chroma/pull/797
@walles Thanks, In fact for another style.. the result outcome is not that good I means only this area Moar lack a functionality compare to BAT else moar has unmatched and the best tool
Is this closer to what you'd expect from --style=catppuccin-macchiato
?
Is this closer to what you'd expect from
--style=catppuccin-macchiato
?
yes color point of view it's now as per your SS seems matching but there is no highlight at least for some keyword like IP/Port HEX value etc. as bat is doing
If you want log file highlighting you have to request it here:
If you want log file highlighting you have to request it here:
The request is already raised but I don't know whether they will do it or not.
@walles is this --style=catppuccin-macchiato? issue resolved as I am still having the problem and this style showing red color
Just released moar v1.18.2
with that fix in it.
Just released
moar v1.18.2
with that fix in it.
ok Thanks!
I have tried moar --style=gruvbox and suppose that moar will render the color format in gruvbox theme but it seems not working and moar is using default terminal theme color style for moar.. Running latest moar version on macOS sonoma 14.0 version. Ideally it should use the terminal theme style only when no --style switch option used along with moar