def get_command(self, ctx, name):
try:
if sys.version_info[0] == 2:
name = name.encode('ascii', 'replace')
splitted = name.split('_')
if len(splitted) <= 1:
return
module_name, command_name = splitted
if not all([module_name, command_name]):
return
module = '{0}.{1}.commands.{2}'.format(
self.base_module_name,
module_name,
command_name)
mod = importlib.import_module(module)
except ImportError:
return
return getattr(mod, 'cli', None)
评论列表
文章目录