aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/plugins/command/console.py
diff options
context:
space:
mode:
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