[tor-commits] [stem/master] Help output had an extra newline

atagar at torproject.org atagar at torproject.org
Tue May 6 01:21:13 UTC 2014


commit dcb9576041720573eac88920f84551d6d562a16d
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon May 5 17:58:50 2014 -0700

    Help output had an extra newline
---
 stem/interpretor/help.py      |   14 +++++++-------
 test/unit/interpretor/help.py |   10 +++++-----
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/stem/interpretor/help.py b/stem/interpretor/help.py
index 039bbef..caa64e0 100644
--- a/stem/interpretor/help.py
+++ b/stem/interpretor/help.py
@@ -80,7 +80,7 @@ def _response(controller, arg, config):
           opt, summary = line.split(' -- ', 1)
 
           output += format("%-33s" % opt, *BOLD_OUTPUT)
-          output += format(" - %s\n" % summary, *STANDARD_OUTPUT)
+          output += format(" - %s" % summary, *STANDARD_OUTPUT) + '\n'
   elif arg == 'GETCONF':
     results = controller.get_info('config/names', None)
 
@@ -93,13 +93,13 @@ def _response(controller, arg, config):
         for entry in options[i:i + 2]:
           line += '%-42s' % entry
 
-        output += format(line.rstrip() + '\n', *STANDARD_OUTPUT)
+        output += format(line.rstrip(), *STANDARD_OUTPUT) + '\n'
   elif arg == 'SIGNAL':
     signal_options = config.get('help.signal.options', {})
 
     for signal, summary in signal_options.items():
       output += format('%-15s' % signal, *BOLD_OUTPUT)
-      output += format(' - %s\n' % summary, *STANDARD_OUTPUT)
+      output += format(' - %s' % summary, *STANDARD_OUTPUT) + '\n'
   elif arg == 'SETEVENTS':
     results = controller.get_info('events/names', None)
 
@@ -114,17 +114,17 @@ def _response(controller, arg, config):
         for entry in entries[i:i + 4]:
           line += '%-20s' % entry
 
-        output += format(line.rstrip() + '\n', *STANDARD_OUTPUT)
+        output += format(line.rstrip(), *STANDARD_OUTPUT) + '\n'
   elif arg == 'USEFEATURE':
     results = controller.get_info('features/names', None)
 
     if results:
-      output += format(results + '\n', *STANDARD_OUTPUT)
+      output += format(results, *STANDARD_OUTPUT) + '\n'
   elif arg in ('LOADCONF', 'POSTDESCRIPTOR'):
     # gives a warning that this option isn't yet implemented
-    output += format(msg('msg.multiline_unimplemented_notice') + '\n', *ERROR_OUTPUT)
+    output += format(msg('msg.multiline_unimplemented_notice'), *ERROR_OUTPUT) + '\n'
 
-  return output
+  return output.rstrip()
 
 
 def _general_help():
diff --git a/test/unit/interpretor/help.py b/test/unit/interpretor/help.py
index ff178a2..e656060 100644
--- a/test/unit/interpretor/help.py
+++ b/test/unit/interpretor/help.py
@@ -31,24 +31,24 @@ class TestHelpResponses(unittest.TestCase):
   def test_getinfo_help(self):
     result = response(CONTROLLER, 'GETINFO')
     self.assertTrue('Queries the tor process for information. Options are...' in result)
-    self.assertTrue('\x1b[34;1minfo/names                       \x1b[0m\x1b[34m - List of GETINFO options, types, and documentation.\n' in result)
+    self.assertTrue('\x1b[34;1minfo/names                       \x1b[0m\x1b[34m - List of GETINFO options, types, and documentation.' in result)
 
   def test_getconf_help(self):
     result = response(CONTROLLER, 'GETCONF')
     self.assertTrue('Provides the current value for a given configuration value. Options include...' in result)
-    self.assertTrue('\x1b[34mExitNodes                                 ExitPolicy\n' in result)
+    self.assertTrue('\x1b[34mExitNodes                                 ExitPolicy' in result)
 
   def test_signal_help(self):
     result = response(CONTROLLER, 'SIGNAL')
     self.assertTrue('Issues a signal that tells the tor process to' in result)
-    self.assertTrue('\x1b[34;1mRELOAD / HUP   \x1b[0m\x1b[34m - reload our torrc\n' in result)
+    self.assertTrue('\x1b[34;1mRELOAD / HUP   \x1b[0m\x1b[34m - reload our torrc' in result)
 
   def test_setevents_help(self):
     result = response(CONTROLLER, 'SETEVENTS')
     self.assertTrue('Sets the events that we will receive.' in result)
-    self.assertTrue('\x1b[34mBW                  DEBUG               INFO                NOTICE\n\x1b[0m' in result)
+    self.assertTrue('\x1b[34mBW                  DEBUG               INFO                NOTICE\x1b[0m' in result)
 
   def test_usefeature_help(self):
     result = response(CONTROLLER, 'USEFEATURE')
     self.assertTrue('Customizes the behavior of the control port.' in result)
-    self.assertTrue('\x1b[34mVERBOSE_NAMES EXTENDED_EVENTS\n\x1b[0m' in result)
+    self.assertTrue('\x1b[34mVERBOSE_NAMES EXTENDED_EVENTS\x1b[0m' in result)





More information about the tor-commits mailing list