aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/plugins/command/console.py
diff options
context:
space:
mode:
authorLibravatarAgustin Henze <tin@sluc.org.ar>2014-02-28 08:49:41 -0300
committerLibravatarAgustin Henze <tin@sluc.org.ar>2014-02-28 08:49:41 -0300
commit0f1e24f7888ba16fe5629c57fd00f0deacb63e5e (patch)
tree7153a3a11b766f375b1d1c0a7adc599e0a9f9c55 /nikola/plugins/command/console.py
parent04fc43563d3d5d4218004690b5e14c19c67bdcbc (diff)
parent2828399ba5cbb14502b023d4de1ba02f13dd5055 (diff)
Merge tag 'upstream/6.3.0'
Upstream version 6.3.0
Diffstat (limited to 'nikola/plugins/command/console.py')
-rw-r--r--nikola/plugins/command/console.py32
1 files changed, 24 insertions, 8 deletions
diff --git a/nikola/plugins/command/console.py b/nikola/plugins/command/console.py
index fe17dfc..e66b650 100644
--- a/nikola/plugins/command/console.py
+++ b/nikola/plugins/command/console.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2013 Roberto Alsina and others.
+# Copyright © 2012-2014 Chris Warrick, Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -39,8 +39,21 @@ class Console(Command):
"""Start debugging console."""
name = "console"
shells = ['ipython', 'bpython', 'plain']
- doc_purpose = "Start an interactive Python (IPython->bpython->plain) console with access to your site and configuration"
+ doc_purpose = "start an interactive Python console with access to your site"
+ doc_description = """\
+Order of resolution: IPython → bpython [deprecated] → plain Python interpreter
+The site engine is accessible as `SITE`, and the config as `conf`."""
header = "Nikola v" + __version__ + " -- {0} Console (conf = configuration, SITE = site engine)"
+ cmd_options = [
+ {
+ 'name': 'plain',
+ 'short': 'p',
+ 'long': 'plain',
+ 'type': bool,
+ 'default': False,
+ 'help': 'Force the plain Python console',
+ }
+ ]
def ipython(self):
"""IPython shell."""
@@ -102,9 +115,12 @@ class Console(Command):
def _execute(self, options, args):
"""Start the console."""
- for shell in self.shells:
- try:
- return getattr(self, shell)()
- except ImportError:
- pass
- raise ImportError
+ if options['plain']:
+ self.plain()
+ else:
+ for shell in self.shells:
+ try:
+ return getattr(self, shell)()
+ except ImportError:
+ pass
+ raise ImportError