remove the useless '--to_file' parameter on boobmsg

This commit is contained in:
Romain Bignon 2011-02-26 10:27:38 +01:00
commit a84b3ea5a3
2 changed files with 4 additions and 11 deletions

View file

@ -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):

View file

@ -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()