Skip to content

Commit

Permalink
more tiny fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JFryy committed Aug 9, 2024
1 parent 3fff40b commit 8bf58f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions codec/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ import (
"github.com/goccy/go-json"
"github.com/goccy/go-yaml"
"strings"
"bytes"
"github.com/alecthomas/chroma"
"github.com/alecthomas/chroma/formatters"
"github.com/alecthomas/chroma/lexers"
"github.com/alecthomas/chroma/styles"
"github.com/mattn/go-isatty"
"os"
// dedicated codec packages and wrappers where appropriate
"github.com/JFryy/qq/codec/markdown"
"github.com/JFryy/qq/codec/html"
"github.com/JFryy/qq/codec/gron"
Expand All @@ -15,13 +23,6 @@ import (
"github.com/JFryy/qq/codec/csv"
"github.com/JFryy/qq/codec/xml"
"github.com/JFryy/qq/codec/ini"
"bytes"
"github.com/alecthomas/chroma"
"github.com/alecthomas/chroma/formatters"
"github.com/alecthomas/chroma/lexers"
"github.com/alecthomas/chroma/styles"
"github.com/mattn/go-isatty"
"os"
)

// EncodingType represents the supported encoding types as an enum with a string representation
Expand Down Expand Up @@ -142,7 +143,8 @@ func PrettyFormat(s string, fileType EncodingType, raw bool) (string, error) {
}

var lexer chroma.Lexer
if fileType == CSV {
// this a workaround for json lexer while we don't have a marshal function dedicated for these formats.
if fileType == CSV || fileType == HTML || fileType == LINE || fileType == TXT {
lexer = lexers.Get("json")
} else {
lexer = lexers.Get(fileType.String())
Expand Down
2 changes: 1 addition & 1 deletion codec/json/json.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package codec
package json

import (
"bytes"
Expand Down

0 comments on commit 8bf58f2

Please sign in to comment.