rendered paste body 1 from bzrlib import plugin
2 from bzrlib import errors
3 import plugin_db
4
5 class DefaultProvider(plugin.Provider):
6
7 def check_for_plugin(self, cmd_name):
8 ret_val = []
9 for elem in self._get_plugins():
10 try:
11 if elem['commands'].index(cmd_name) >= 0:
12 ret_val.append(elem['name'])
13 except:
14 pass
15 if len(ret_val) > 0:
16 raise errors.BzrCommandError('Yay! ')
17
18 def _get_plugins(self):
19 plugin_list = [attr for attr in dir(plugin_db) if not attr.startswith('__') and not attr.endswith('__')]
20 return plugin_list