Append category summary to :categories
authorJack Miller <jack@codezen.org>
Tue, 18 Nov 2014 02:42:52 +0000 (20:42 -0600)
committerJack Miller <jack@codezen.org>
Tue, 18 Nov 2014 02:42:52 +0000 (20:42 -0600)
- In addition to listing the categories of the current tag

canto_curses/taglist.py

index afd10aa..392b657 100644 (file)
@@ -866,6 +866,18 @@ class TagList(GuiBase):
             else:
                 log.info("%s - %s" % (tag, " ".join(categories)))
 
+        popped_cats = []
+        for tag in alltagcores:
+            if tag.tag.startswith("category:"):
+                popped_cats.append(tag.tag[9:])
+
+        if popped_cats:
+            log.info("\nAvailable categories:")
+            for cat in popped_cats:
+                log.info(cat)
+        else:
+            log.info("\nNo categories available.")
+
     def cmd_show_category(self, category):
         if category:
             tag_updater.transform("categories", "InTags(\'" + shlex.quote(category) + "\')")