match path/name/base patterns in colors/icons

Related #505 #506
This commit is contained in:
Gokcehan committed 2020-12-23 04:55:10 +03:00
1 parent 4438721488
commit 1aed76c10d
2 files changed
+26 -2

No files matched your search

+13 -1
View File
@@ -139,7 +139,7 @@ func parseStylesGNU(env string) styleMap {
log.Printf("invalid $LS_COLORS entry: %s", entry)
return styles
}
key, val := pair[0], pair[1]
key, val := replaceTilde(pair[0]), pair[1]
styles[key] = applyAnsiCodes(val, tcell.StyleDefault)
}
@@ -193,6 +193,18 @@ func parseStylesBSD(env string) styleMap {
}
func (cm styleMap) get(f *file) tcell.Style {
if val, ok := cm[f.path]; ok {
return val
}
if val, ok := cm[f.Name()]; ok {
return val
}
if val, ok := cm[filepath.Base(f.Name())+".*"]; ok {
return val
}
var key string
switch {