Add module_name param in add_backend to allow command line interaction

This commit is contained in:
Kitof 2015-04-01 12:00:56 +02:00 committed by Romain Bignon
commit 7155539965
3 changed files with 29 additions and 21 deletions

View file

@ -100,12 +100,19 @@ class WeboobCfg(ReplApplication):
if not line:
print('You must specify a module name. Hint: use the "modules" command.', file=self.stderr)
return 2
name, options = self.parse_command_args(line, 2, 1)
module_name, options = self.parse_command_args(line, 2, 1)
if options:
options = options.split(' ')
else:
options = ()
backend_name = module_name
try:
k, v = options[0].split('=',1)
except ValueError:
backend_name = options[0]
del options[0]
params = {}
# set backend params from command-line arguments
for option in options:
@ -116,7 +123,7 @@ class WeboobCfg(ReplApplication):
return 2
params[key] = value
self.add_backend(name, params)
self.add_backend(module_name, backend_name, params)
def do_register(self, line):
"""