Adding a shortcut for pecan shell config.py --shell=XXX.
This commit is contained in:
@@ -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()
|
||||||
|
if isinstance(arg.get('command'), basestring):
|
||||||
sub.add_argument(arg.pop('command'), **arg)
|
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)
|
||||||
|
|||||||
@@ -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'
|
||||||
|
|||||||
Reference in New Issue
Block a user