sharkdp / bat

A cat(1) clone with wings.
Apache License 2.0
48.76k stars 1.23k forks source link

Not possible to specify jsonl (JSON lines) in the language parameter #3042

Open aliok opened 1 month ago

aliok commented 1 month ago

I follow logs of a Kubernetes pod. Those logs are in jsonl format (https://jsonlines.org/), where each line is a valid and complete JSON entry.

I see jsonl support is added here: https://github.com/sharkdp/bat/pull/2539. However, it only uses jsonl format if a file name ends with .jsonl. In my case, I use a pipe like

kubectl logs -n my-pod --follow | bat --paging=never -l jsonl

which doesn't work: [bat error]: unknown syntax: 'jsonl'

Is it possible to add a separate language entry for jsonl?

keith-hall commented 1 month ago

Currently the .jsonl files are mapped to the JSON syntax so you should be able to just use -l json.

aliok commented 1 month ago

But in case of a pipe, the tool won't understand that the input is jsonl and not json, hence not doing the syntax highlighting properly.