+ if match.command('assign-item-to-store'):
+ item_id = int(match.args()[1])
+ store_id = int(match.args()[2])
+ Data().assign_store(item_id, store_id)
+ return ['Success']
+
+ if match.command('assign'):
+ item_id = int(match.args()[1])
+ Data().assign_last_store(item_id)
+
+ # Now print the list for the assigned store
+ items = Data().get_last_shopping_list()
+ results = ['Shopping List']
+ for item in items:
+ results.append(str(item))
+ return results
+
+ if match.command('buy'):
+ item_id = ' '.join(match.args()[1:])
+ Data().purchase_item(item_id)
+ return ['Success']
+
+ if match.command('clear'):
+ store_id = ' '.join(match.args()[1:])
+ Data().clear_list(store_id)
+ self.last_store_id = None
+ return ['Success']
+
+ if match.command('clear-all'):
+ store_id = ' '.join(match.args()[1:])
+ Data().clear_list(store_id, clear_all=True)
+ return ['Success']
+
+
+ if match.command('list-for-store'):
+ store_id = ' '.join(match.args()[1])
+ items = Data().get_shopping_list_for_store(store_id)
+ results = ['Shopping List']
+ for item in items:
+ results.append(str(item))
+ return results