diff --git a/python/placement.py b/python/placement.py index 8b03194..282c654 100644 --- a/python/placement.py +++ b/python/placement.py @@ -1,6 +1,6 @@ from web.library.models import Placement -def print_shelf(shelf, title=None): +def print_shelf(shelf, category=None, title=None): # Discover the dimensions of the shelves cols = len(shelf) rows, cell_height, cell_width = 0,0,0 @@ -37,6 +37,9 @@ def print_shelf(shelf, title=None): except: content = "" + + if category and content.upper() == category.upper(): + content = "\x1B[31;1m" + content.upper() + "\x1B[0m" spacing = " "*(cell_width-len(content)) output.append( format_cell %(content, spacing) ) @@ -55,9 +58,9 @@ def print_all_shelves(): print_shelf(Placement.shelf_as_list(shelfname), title=shelfname) -def print_shelf_cmd(shelfname): +def print_shelf_cmd(shelfname, category): if shelfname: - print_shelf(Placement.shelf_as_list(shelfname), title=shelfname) + print_shelf(Placement.shelf_as_list(shelfname), category=category, title=shelfname) else: print_all_shelves() diff --git a/python/worblehat.py b/python/worblehat.py index ccf507c..5bc4694 100755 --- a/python/worblehat.py +++ b/python/worblehat.py @@ -89,7 +89,7 @@ commands = { 'show': 'options': [], 'fun': edit_book_or_person }, 'map': - { 'args': [('shelfname', (0,1))], + { 'args': [('shelfname', (0,1)), ('category', (0,1))], 'options': [], 'fun': placement.print_shelf_cmd } }