fix parse_args conflict
This commit is contained in:
parent
5bdd1540fe
commit
e9ede31053
9 changed files with 14 additions and 12 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue