Closed mjholub closed 11 months ago
Hello!
Regarding JSON, I think piping through jq
might be even better, since that would give you formatting as well:
echo '{"url":"https://github.com/walles/riff"}' | jq -C | moar
Except for JSON, what other file types do you tend to read from scripts?
well, that'd be mostly it, thanks for the jq hack, although one example I can think of are OpenRC service files, which use shell script syntax, but have no file extensions. Same goes for some scripts that are added to $PATH
and for convenience also use no extension, e.g. neofetch. Same with some python, perl, ruby or node standalone scripts that may e.g. just specify their interpreter on the first line.
Some markdown, yaml or config files may also not always have an extension.
Except for JSON, how often have you actually been missing this?
Enough that you'd have manually specified a MIME type on the command line?
This could be implemented, but I'm unsure how much use it would actually see.
Just released v1.21.0 where you can use the -lang
option for telling the highlighter about the input file language.
Even better, in this release JSON coming from pipes is auto detected and highlighted accordingly:
We all often pipe something from STDOUT to a pager. The output can often be in a json format (e.g. from a logger) or a shell script (though I'm not sure if moar simply looks for a shebang in such instances, since many script files don't necessarily contain an extension), and therefore it'd be really useful if instead of first writing the output to a temporary file or rename the files, be able to explicitly set the filetype in moar, similar to using
set ft
in Vim.