Adding a shortcut for pecan shell config.py --shell=XXX.

This commit is contained in:
Ryan Petrello
2012-03-20 19:25:28 -04:00
parent 8cb08af541
commit d2b835c242
3 changed files with 7 additions and 4 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -78,7 +78,10 @@ class CommandRunner(object):
) )
for arg in getattr(cmd, 'arguments', tuple()): for arg in getattr(cmd, 'arguments', tuple()):
arg = arg.copy() arg = arg.copy()
sub.add_argument(arg.pop('command'), **arg) if isinstance(arg.get('command'), basestring):
sub.add_argument(arg.pop('command'), **arg)
elif isinstance(arg.get('command'), list):
sub.add_argument(*arg.pop('command'), **arg)
def run(self, args): def run(self, args):
ns = self.parser.parse_args(args) ns = self.parser.parse_args(args)

View File

@@ -10,7 +10,7 @@ import sys
class NativePythonShell(object): class NativePythonShell(object):
@classmethod @classmethod
def invoke(cls, ns, banner): def invoke(cls, ns, banner): # pragma: nocover
import code import code
py_prefix = sys.platform.startswith('java') and 'J' or 'P' py_prefix = sys.platform.startswith('java') and 'J' or 'P'
shell_banner = 'Pecan Interactive Shell\n%sython %s\n\n' % \ shell_banner = 'Pecan Interactive Shell\n%sython %s\n\n' % \
@@ -26,7 +26,7 @@ class NativePythonShell(object):
class IPythonShell(object): class IPythonShell(object):
@classmethod @classmethod
def invoke(cls, ns, banner): def invoke(cls, ns, banner): # pragma: nocover
try: try:
from IPython.frontend.terminal.embed import ( from IPython.frontend.terminal.embed import (
InteractiveShellEmbed InteractiveShellEmbed
@@ -51,7 +51,7 @@ class ShellCommand(BaseCommand):
} }
arguments = BaseCommand.arguments + ({ arguments = BaseCommand.arguments + ({
'command': '--shell', 'command': ['--shell', '-s'],
'help': 'which Python shell to use', 'help': 'which Python shell to use',
'choices': SHELLS.keys(), 'choices': SHELLS.keys(),
'default': 'python' 'default': 'python'