commit f2cabcdf9618af85005e830e2aa0d72a4e369a3f
Author: Damian Johnson <atagar(a)torproject.org>
Date: Mon May 5 18:02:40 2014 -0700
Always include an empty line before the next prompt
---
stem/interpretor/commands.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/stem/interpretor/commands.py b/stem/interpretor/commands.py
index 8e94f93..ecea859 100644
--- a/stem/interpretor/commands.py
+++ b/stem/interpretor/commands.py
@@ -225,8 +225,6 @@ class …
[View More]ControlInterpretor(object):
output = self.do_help(arg)
else:
output = format("'%s' isn't a recognized command" % command, *ERROR_OUTPUT)
-
- output += '\n' # give ourselves an extra line before the next prompt
else:
cmd = cmd.upper() # makes commands uppercase to match the spec
@@ -316,4 +314,6 @@ class ControlInterpretor(object):
else:
output = format(str(exc), *ERROR_OUTPUT)
+ output += '\n' # give ourselves an extra line before the next prompt
+
return output
[View Less]
commit 1b21c24d1a6ba02fe1eea191379eb6c9811657fe
Merge: 0d357a9 f2cabcd
Author: Damian Johnson <atagar(a)torproject.org>
Date: Mon May 5 18:03:46 2014 -0700
Interpretor prompt
Arm's 1.4.5 release included an interpretor panel that allowed raw control
port access with usability improvements like...
* tab completion
* history by pressing up/down
* terminal coloring to improve readability
* irc-style functions such as '/help' and '/info'
…
[View More] This was pretty slick but rarely used, and is being removed from the next arm
release.
The trouble isn't with the feature, but rather the audience. Raw control port
access is useful to learn about tor's controller interface and debug
during development. This didn't match arm's audience, who are primarily relay
operators and power users. However, it's *perfect* for Stem!
This is a rewritten version of arm's interpretor...
https://gitweb.torproject.org/arm.git/blob/e249dc8f5c4c282326324161cf8421f9…
Functionally this is the same as arm's, but is much more modular and better
tested. Pending improvements I plan include...
* tutorial to introduce new stem users to the prompt
* option to get a python prompt (similar to our old 'prompt' command)
prompt | 23 +--
prompt_old | 19 ++
stem/interpretor/__init__.py | 85 +++++++++
stem/interpretor/arguments.py | 92 ++++++++++
stem/interpretor/autocomplete.py | 112 ++++++++++++
stem/interpretor/commands.py | 319 +++++++++++++++++++++++++++++++++
stem/interpretor/help.py | 142 +++++++++++++++
stem/interpretor/settings.cfg | 259 ++++++++++++++++++++++++++
stem/response/__init__.py | 1 +
stem/util/conf.py | 51 +++++-
stem/util/term.py | 3 +-
test/settings.cfg | 4 +
test/unit/interpretor/__init__.py | 39 ++++
test/unit/interpretor/arguments.py | 57 ++++++
test/unit/interpretor/autocomplete.py | 112 ++++++++++++
test/unit/interpretor/commands.py | 216 ++++++++++++++++++++++
test/unit/interpretor/help.py | 54 ++++++
17 files changed, 1568 insertions(+), 20 deletions(-)
[View Less]