def once(plugin, parent_item=None): '''A run mode for the CLI that runs the plugin once and exits.''' plugin.clear_added_items() items = plugin.run() # Prepend the parent_item if given if parent_item is not None: items.insert(0, parent_item) display_listitems(items) return items
def once(plugin, parent_stack=None): '''A run mode for the CLI that runs the plugin once and exits.''' plugin.clear_added_items() items = plugin.run() # if update_listing=True, we need to remove the last url from the parent # stack if parent_stack and plugin._update_listing: del parent_stack[-1] # if we have parent items, include the most recent in the display if parent_stack: items.insert(0, parent_stack[-1]) display_listitems(items, plugin.request.url) return items