From bb21bdb49b6ff612259583e00c56f6f8b6fcbfb1 Mon Sep 17 00:00:00 2001 From: rsteube Date: Mon, 26 Feb 2024 10:14:52 +0100 Subject: [PATCH] style: added ForExtension --- pkg/style/path.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/style/path.go b/pkg/style/path.go index f81dfed29..69bf45993 100644 --- a/pkg/style/path.go +++ b/pkg/style/path.go @@ -28,6 +28,13 @@ func ForPathExt(path string, sc Context) string { return fromSGR(lscolors.GetColorist(sc.Getenv("LS_COLORS")).GetStyleExt(path)) } +// ForExtension returns the style for given extension +// +// json +func ForExtension(path string, sc Context) string { + return ForPathExt("."+path, sc) +} + func fromSGR(sgr string) string { s := ui.StyleFromSGR(sgr) result := []string{}