Skip to content

Commit

Permalink
Print application/json files with chroma by default
Browse files Browse the repository at this point in the history
Fix #34.
  • Loading branch information
doronbehar committed Sep 26, 2020
1 parent 34eb470 commit 69aaad4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ test: pistol
@echo mimetype + sh:
@echo -------------------
@./pistol --config tests/config tests/mimetype-with-sh
@tput sgr0
@echo -------------------
@echo application/json \(issue '#'34\):
@echo -------------------
@./pistol --config tests/config tests/34.json

deps:
go get github.com/c4milo/github-release
Expand Down
2 changes: 2 additions & 0 deletions internal_writers/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (

var internalWritersRegexMap = map[string] func(string, string) (func(w io.Writer) error, error) {
"text/*": NewChromaWriter,
// https://github.com/doronbehar/pistol/issues/34
"application/json": NewChromaWriter,
"application/zip": NewArchiveLister,
"application/x-rar-compressed": NewArchiveLister,
"application/x-tar": NewArchiveLister,
Expand Down
5 changes: 5 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"config:base"
]
}
3 changes: 3 additions & 0 deletions tests/34.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"text": "A JSON file should be printed with JSON chroma syntax highlighting"
}

0 comments on commit 69aaad4

Please sign in to comment.