diff --git a/cccli/tagdisplay.py b/cccli/tagdisplay.py index b1f6da4adfdb28aad8b58e4d26f48bb98f63222f..1b418d7f770bc522b41fa4c246c86dca5a17a448 100644 --- a/cccli/tagdisplay.py +++ b/cccli/tagdisplay.py @@ -50,8 +50,14 @@ class TagDisplay(object): def color(self, tagname): '''Return the current tag color''' - if tagname in self.tagcolor and self.tagcolor[tagname] in color: - return color[self.tagcolor[tagname]] + tagname = unicode(tagname) + # build list of matching pattern with tagname + l = [ x for x in self.tagcolor if fnmatch.fnmatch(tagname, x) ] + if len(l) > 0: + # select longest match + tm = max(l) + if self.tagcolor[tm] in color: + return color[self.tagcolor[tm]] return color["yellow"] def resolve(self, tagname, tagvalue):