From a84b3ea5a3829839e29d313dceb98f98d115d4b0 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sat, 26 Feb 2011 10:27:38 +0100 Subject: [PATCH] remove the useless '--to_file' parameter on boobmsg --- weboob/applications/boobmsg/boobmsg.py | 9 +-------- weboob/tools/application/repl.py | 6 +++--- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/weboob/applications/boobmsg/boobmsg.py b/weboob/applications/boobmsg/boobmsg.py index a39c8e68..91cd0918 100644 --- a/weboob/applications/boobmsg/boobmsg.py +++ b/weboob/applications/boobmsg/boobmsg.py @@ -162,9 +162,6 @@ class Boobmsg(ReplApplication): def add_application_options(self, group): group.add_option('-e', '--skip-empty', action='store_true', help='Don\'t send messages with an empty body.') - group.add_option('--to_file', action='store', - help='File to export result', type="string", - dest="filename") group.add_option('-t', '--title', action='store', help='For the "post" command, set a title to message', type='string', dest='title') @@ -300,13 +297,9 @@ class Boobmsg(ReplApplication): """ _id, backend_name = self.parse_id(arg) cmd = self.do('get_thread', _id, backends=backend_name) - if self.options.filename: - output = self.options.filename - else: - output = sys.stdout for backend, thread in cmd: for msg in thread.iter_all_messages(): - self.format(msg, output=output) + self.format(msg) def do_show(self, arg): diff --git a/weboob/tools/application/repl.py b/weboob/tools/application/repl.py index b95c762d..56a6291e 100644 --- a/weboob/tools/application/repl.py +++ b/weboob/tools/application/repl.py @@ -144,7 +144,7 @@ class ReplApplication(Cmd, BaseApplication): help='select output formatter (%s)' % u', '.join(available_formatters)) formatting_options.add_option('--no-header', dest='no_header', action='store_true', help='do not display header') formatting_options.add_option('--no-keys', dest='no_keys', action='store_true', help='do not display item keys') - formatting_options.add_option('--outfile', dest='outfile', help='file to export result') + formatting_options.add_option('-O', '--outfile', dest='outfile', help='file to export result') self._parser.add_option_group(formatting_options) self._interactive = False @@ -1077,17 +1077,17 @@ class ReplApplication(Cmd, BaseApplication): def set_formatter_header(self, string): self.formatter.set_header(string) - def format(self, result, output=sys.stdout): + def format(self, result): fields = self.selected_fields if fields in ('$direct', '$full'): fields = None - self.formatter.output = output try: self.formatter.format(obj=result, selected_fields=fields) except FieldNotFound, e: print e except MandatoryFieldsNotFound, e: print >> sys.stderr, '%s Hint: select missing fields or use another formatter (ex: multiline).' % e + def flush(self): self.formatter.flush()