dotfiles/.local/bin/scripts/cj

9 lines
315 B
Plaintext
Raw Normal View History

2021-01-23 19:23:40 +00:00
#!/bin/sh
2021-07-29 14:02:20 +00:00
# [c]at the given files as prettified [j]son
2022-08-29 15:17:42 +00:00
# TODO quit on interrupt
2022-07-18 10:56:48 +00:00
# add echo in case file is missing newline at the end
2022-08-29 15:17:42 +00:00
{ cat "$@"; echo; } | while read -r line
do test -n "$line" && python -c "import json; print(json.dumps($line, ensure_ascii=False))"
done | bat --language json --style numbers