| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | brt_json() { |
| 4 | local input="${1:--}" |
| 5 | brt_require python3 |
| 6 | |
| 7 | if [[ "$input" == "-" ]]; then |
| 8 | python3 -m json.tool |
| 9 | elif [[ -f "$input" ]]; then |
| 10 | python3 -m json.tool "$input" |
| 11 | else |
| 12 | echo "$input" | python3 -m json.tool |
| 13 | fi |
| 14 | } |
| 15 | |