X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=blobdiff_plain;f=htsworkflow%2Ffrontend%2Fbcmagic%2Fplugin.py;h=d701cf383d3bd91b12d5ade1db3e8beb55629015;hp=6653fd9261331b6d43cec48e8810ee4feabd3ebb;hb=5f645ab6ae26b456f5b11b9e764da7e9c5367f1d;hpb=753584c653403e158bf3b830ef1f1489adb61148 diff --git a/htsworkflow/frontend/bcmagic/plugin.py b/htsworkflow/frontend/bcmagic/plugin.py index 6653fd9..d701cf3 100644 --- a/htsworkflow/frontend/bcmagic/plugin.py +++ b/htsworkflow/frontend/bcmagic/plugin.py @@ -2,6 +2,7 @@ #BCM_PLUGINS = {'cmd_move_sample': bcm_cmds.cmd_move_sample} +_SEARCH_FUNCTIONS = {} def bcm_plugin_processor(keyword, text, bcm_mode): """ @@ -15,4 +16,19 @@ def bcm_plugin_processor(keyword, text, bcm_mode): d['status'] = 'bcm_mode plugin called "%s" was not found' % (bcm_mode) return d - return BCM_PLUGINS[bcm_mode](keyword, text, bcm_mode) \ No newline at end of file + return BCM_PLUGINS[bcm_mode](keyword, text, bcm_mode) + + +def register_search_plugin(label, search_function): + """ + Registers a group label and search_function + + search_function(search_string) --> (text_display, obj_url) + """ + + if label in _SEARCH_FUNCTIONS: + msg = "search function for label (%s) already registered." % (label) + raise ValueError, msg + + _SEARCH_FUNCTIONS[label] = search_function + \ No newline at end of file