diff --git a/weboob/applications/boobank/boobank.py b/weboob/applications/boobank/boobank.py index 1db00c53..1196ada7 100644 --- a/weboob/applications/boobank/boobank.py +++ b/weboob/applications/boobank/boobank.py @@ -196,7 +196,7 @@ class Boobank(ReplApplication): If you give only the ACCOUNT parameter, it lists all the available recipients for this account. """ - id_from, id_to, amount, reason = self.parse_args(line, 4, 1) + id_from, id_to, amount, reason = self.parse_command_args(line, 4, 1) id_from, backend_name_from = self.parse_id(id_from) if not id_to: diff --git a/weboob/applications/boobmsg/boobmsg.py b/weboob/applications/boobmsg/boobmsg.py index d374e862..0df129e3 100644 --- a/weboob/applications/boobmsg/boobmsg.py +++ b/weboob/applications/boobmsg/boobmsg.py @@ -48,6 +48,7 @@ class MessageFormatter(IFormatter): result += '\n%s' % content return result + class MessagesListFormatter(IFormatter): MANDATORY_FIELDS = () count = 0 @@ -119,6 +120,7 @@ class MessagesListFormatter(IFormatter): result += self.format_message(backend, m, depth) return result + class Boobmsg(ReplApplication): APPNAME = 'boobmsg' VERSION = '0.5' @@ -177,7 +179,7 @@ class Boobmsg(ReplApplication): If no text is supplied on command line, the content of message is read on stdin. """ - receivers, text = self.parse_args(line, 2, 1) + receivers, text = self.parse_command_args(line, 2, 1) if text is None: if self.interactive: print 'Reading message content from stdin... Type ctrl-D from an empty line to post message.' @@ -187,7 +189,7 @@ class Boobmsg(ReplApplication): return for receiver in receivers.strip().split(','): - receiver, backend_name = self.parse_id(receiver.strip()) + receiver, backend_name = self.parse_id(receiver.strip(), unique_backend=True) if not backend_name and len(self.enabled_backends) > 1: self.logger.warning(u'No backend specified for receiver "%s": message will be sent with all the ' 'enabled backends (%s)' % (receiver, diff --git a/weboob/applications/chatoob/chatoob.py b/weboob/applications/chatoob/chatoob.py index 305951ba..f71b5bda 100644 --- a/weboob/applications/chatoob/chatoob.py +++ b/weboob/applications/chatoob/chatoob.py @@ -62,7 +62,7 @@ class Chatoob(ReplApplication): Send a message to the specified contact. """ - _id, message = self.parse_args(line, 2, 2) + _id, message = self.parse_command_args(line, 2, 2) for backend, result in self.do('send_chat_message', _id, message): if not result: logging.error(u'Failed to send message to contact id="%s" on backend "%s"' % (_id, backend.name)) diff --git a/weboob/applications/havesex/havesex.py b/weboob/applications/havesex/havesex.py index d520149e..0b1ff7cf 100644 --- a/weboob/applications/havesex/havesex.py +++ b/weboob/applications/havesex/havesex.py @@ -240,7 +240,7 @@ class HaveSex(ReplApplication): * edit configure an optimization service for a backend * stop stop optimization services on a backend """ - cmd, backend_name, optims_names = self.parse_args(line, 3) + cmd, backend_name, optims_names = self.parse_command_args(line, 3) if backend_name == '*': backend_name = None diff --git a/weboob/applications/traveloob/traveloob.py b/weboob/applications/traveloob/traveloob.py index 2f553cc6..7539783e 100644 --- a/weboob/applications/traveloob/traveloob.py +++ b/weboob/applications/traveloob/traveloob.py @@ -49,7 +49,7 @@ class Traveloob(ReplApplication): List all departures for a given station. """ - station, arrival = self.parse_args(line, 2, 1) + station, arrival = self.parse_command_args(line, 2, 1) station_id, backend_name = self.parse_id(station) if arrival: diff --git a/weboob/applications/weboobcfg/weboobcfg.py b/weboob/applications/weboobcfg/weboobcfg.py index e6548bd5..b149d48c 100644 --- a/weboob/applications/weboobcfg/weboobcfg.py +++ b/weboob/applications/weboobcfg/weboobcfg.py @@ -52,7 +52,7 @@ class WeboobCfg(ReplApplication): if not line: print >>sys.stderr, 'You must specify a backend name. Hint: use the "backends" command.' return - name, options = self.parse_args(line, 2, 1) + name, options = self.parse_command_args(line, 2, 1) if options: options = options.split(' ') else: diff --git a/weboob/applications/weboorrents/weboorrents.py b/weboob/applications/weboorrents/weboorrents.py index f16ef644..89aad1ad 100644 --- a/weboob/applications/weboorrents/weboorrents.py +++ b/weboob/applications/weboorrents/weboorrents.py @@ -144,7 +144,7 @@ class Weboorrents(ReplApplication): FILENAME is where to write the file. If FILENAME is '-', the file is written to stdout. """ - id, dest = self.parse_args(line, 2, 2) + id, dest = self.parse_command_args(line, 2, 2) _id, backend_name = self.parse_id(id) diff --git a/weboob/applications/wetboobs/wetboobs.py b/weboob/applications/wetboobs/wetboobs.py index 9773b7a7..9d597327 100644 --- a/weboob/applications/wetboobs/wetboobs.py +++ b/weboob/applications/wetboobs/wetboobs.py @@ -125,7 +125,7 @@ class WetBoobs(ReplApplication): Get current weather for specified city. Use the 'search' command to find its ID. """ - city, = self.parse_args(line, 1, 1) + city, = self.parse_command_args(line, 1, 1) _id, backend_name = self.parse_id(city) for backend, current in self.do('get_current', _id, backends=backend_name): if current: @@ -144,7 +144,7 @@ class WetBoobs(ReplApplication): Get forecasts for specified city. Use the 'search' command to find its ID. """ - city, = self.parse_args(line, 1, 1) + city, = self.parse_command_args(line, 1, 1) _id, backend_name = self.parse_id(city) for backend, forecast in self.do('iter_forecast', _id, backends=backend_name): self.format(forecast) diff --git a/weboob/tools/application/repl.py b/weboob/tools/application/repl.py index edc9cf86..8b661226 100644 --- a/weboob/tools/application/repl.py +++ b/weboob/tools/application/repl.py @@ -343,7 +343,7 @@ class ReplApplication(Cmd, BaseApplication): except BackendNotFound, e: logging.error(e) - def parse_args(self, line, nb, req_n=None): + def parse_command_args(self, line, nb, req_n=None): if line.strip() == '': # because ''.split() = [''] args = [] @@ -758,7 +758,7 @@ class ReplApplication(Cmd, BaseApplication): * quiet is an alias for error * default is an alias for warning """ - args = self.parse_args(line, 1, 0) + args = self.parse_command_args(line, 1, 0) levels = (('debug', logging.DEBUG), ('info', logging.INFO), ('warning', logging.WARNING),