completion of command 'formatter'
This commit is contained in:
parent
0eba4302a5
commit
96a9bb4b8f
1 changed files with 17 additions and 5 deletions
|
|
@ -393,12 +393,10 @@ class ReplApplication(Cmd, BaseApplication):
|
||||||
available_backends_names = set(backend.name for backend in self.weboob.iter_backends())
|
available_backends_names = set(backend.name for backend in self.weboob.iter_backends())
|
||||||
enabled_backends_names = set(backend.name for backend in self.enabled_backends)
|
enabled_backends_names = set(backend.name for backend in self.enabled_backends)
|
||||||
|
|
||||||
args = line.split()
|
args = line.split(' ')
|
||||||
if len(args) == 1 or len(args) == 2 and args[1] not in commands:
|
if len(args) == 2:
|
||||||
choices = commands
|
choices = commands
|
||||||
elif len(args) == 2 and args[1] in commands or \
|
elif len(args) == 3:
|
||||||
len(args) == 3 and args[1] in ('enable', 'only') and args[2] not in available_backends_names or \
|
|
||||||
len(args) == 3 and args[1] == 'disable' and args[2] not in enabled_backends_names:
|
|
||||||
if args[1] == 'enable':
|
if args[1] == 'enable':
|
||||||
choices = sorted(available_backends_names - enabled_backends_names)
|
choices = sorted(available_backends_names - enabled_backends_names)
|
||||||
elif args[1] == 'only':
|
elif args[1] == 'only':
|
||||||
|
|
@ -462,6 +460,20 @@ class ReplApplication(Cmd, BaseApplication):
|
||||||
else:
|
else:
|
||||||
print self.options.count
|
print self.options.count
|
||||||
|
|
||||||
|
def complete_formatter(self, text, line, *ignored):
|
||||||
|
commands = list(available_formatters) + ['list', 'option']
|
||||||
|
options = ['header', 'keys']
|
||||||
|
option_values = ['on', 'off']
|
||||||
|
|
||||||
|
args = line.split(' ')
|
||||||
|
if len(args) == 2:
|
||||||
|
return commands
|
||||||
|
if args[1] == 'option':
|
||||||
|
if len(args) == 3:
|
||||||
|
return options
|
||||||
|
if len(args) == 4:
|
||||||
|
return option_values
|
||||||
|
|
||||||
def do_formatter(self, line):
|
def do_formatter(self, line):
|
||||||
"""
|
"""
|
||||||
formatter [FORMATTER_NAME | list | option OPTION_NAME [on | off]]
|
formatter [FORMATTER_NAME | list | option OPTION_NAME [on | off]]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue