Skip to content

Commit

Permalink
Fix refactoring that broke scripts/commands_to_rst.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed May 5, 2016
1 parent dd3ac94 commit 76d99b9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions planemo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ def list_cmds():
return rv


def _name_to_command(name):
def name_to_command(name):
"""Convert a subcommand name to the cli function for that command.
Command <X> is defined by the method 'planemo.commands.cmd_<x>:cli',
this method uses `__import__` to load and return that method.
"""
try:
if sys.version_info[0] == 2:
name = name.encode('ascii', 'replace')
Expand All @@ -154,7 +159,7 @@ def list_commands(self, ctx):
def get_command(self, ctx, name):
if name in COMMAND_ALIASES:
name = COMMAND_ALIASES[name]
return _name_to_command(name)
return name_to_command(name)


def command_function(f):
Expand Down Expand Up @@ -202,8 +207,9 @@ def planemo(ctx, config, directory, verbose):


__all__ = [
"command_function",
"Context",
"list_cmds",
"command_function",
"name_to_command",
"planemo",
]

0 comments on commit 76d99b9

Please sign in to comment.