remove the useless '--to_file' parameter on boobmsg
This commit is contained in:
parent
3676f7eec6
commit
a84b3ea5a3
2 changed files with 4 additions and 11 deletions
|
|
@ -162,9 +162,6 @@ class Boobmsg(ReplApplication):
|
||||||
def add_application_options(self, group):
|
def add_application_options(self, group):
|
||||||
group.add_option('-e', '--skip-empty', action='store_true',
|
group.add_option('-e', '--skip-empty', action='store_true',
|
||||||
help='Don\'t send messages with an empty body.')
|
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',
|
group.add_option('-t', '--title', action='store',
|
||||||
help='For the "post" command, set a title to message',
|
help='For the "post" command, set a title to message',
|
||||||
type='string', dest='title')
|
type='string', dest='title')
|
||||||
|
|
@ -300,13 +297,9 @@ class Boobmsg(ReplApplication):
|
||||||
"""
|
"""
|
||||||
_id, backend_name = self.parse_id(arg)
|
_id, backend_name = self.parse_id(arg)
|
||||||
cmd = self.do('get_thread', _id, backends=backend_name)
|
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 backend, thread in cmd:
|
||||||
for msg in thread.iter_all_messages():
|
for msg in thread.iter_all_messages():
|
||||||
self.format(msg, output=output)
|
self.format(msg)
|
||||||
|
|
||||||
|
|
||||||
def do_show(self, arg):
|
def do_show(self, arg):
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ class ReplApplication(Cmd, BaseApplication):
|
||||||
help='select output formatter (%s)' % u', '.join(available_formatters))
|
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-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('--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._parser.add_option_group(formatting_options)
|
||||||
|
|
||||||
self._interactive = False
|
self._interactive = False
|
||||||
|
|
@ -1077,17 +1077,17 @@ class ReplApplication(Cmd, BaseApplication):
|
||||||
def set_formatter_header(self, string):
|
def set_formatter_header(self, string):
|
||||||
self.formatter.set_header(string)
|
self.formatter.set_header(string)
|
||||||
|
|
||||||
def format(self, result, output=sys.stdout):
|
def format(self, result):
|
||||||
fields = self.selected_fields
|
fields = self.selected_fields
|
||||||
if fields in ('$direct', '$full'):
|
if fields in ('$direct', '$full'):
|
||||||
fields = None
|
fields = None
|
||||||
self.formatter.output = output
|
|
||||||
try:
|
try:
|
||||||
self.formatter.format(obj=result, selected_fields=fields)
|
self.formatter.format(obj=result, selected_fields=fields)
|
||||||
except FieldNotFound, e:
|
except FieldNotFound, e:
|
||||||
print e
|
print e
|
||||||
except MandatoryFieldsNotFound, e:
|
except MandatoryFieldsNotFound, e:
|
||||||
print >> sys.stderr, '%s Hint: select missing fields or use another formatter (ex: multiline).' % e
|
print >> sys.stderr, '%s Hint: select missing fields or use another formatter (ex: multiline).' % e
|
||||||
|
|
||||||
def flush(self):
|
def flush(self):
|
||||||
self.formatter.flush()
|
self.formatter.flush()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue