Skip to content

Commit 7d529b7

Browse files
authored
Merge pull request #996 from rsteube/style-forextension
style: added ForExtension
2 parents 1a41eb8 + bb21bdb commit 7d529b7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: pkg/style/path.go

+7
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ func ForPathExt(path string, sc Context) string {
2828
return fromSGR(lscolors.GetColorist(sc.Getenv("LS_COLORS")).GetStyleExt(path))
2929
}
3030

31+
// ForExtension returns the style for given extension
32+
//
33+
// json
34+
func ForExtension(path string, sc Context) string {
35+
return ForPathExt("."+path, sc)
36+
}
37+
3138
func fromSGR(sgr string) string {
3239
s := ui.StyleFromSGR(sgr)
3340
result := []string{}

0 commit comments

Comments
 (0)