Pass the config to plugins on parser modification to allow completion.

This commit is contained in:
Olivier Mangin 2017-05-22 19:09:24 -04:00
parent 576d907a78
commit e129398311
3 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@ class PapersPlugin(object):
name = None
def get_commands(self, subparsers):
def get_commands(self, subparsers, conf):
"""Populates the parser with plugins specific command.
Returns iterable of pairs (command name, command function to call).
"""

View File

@ -65,7 +65,7 @@ class AliasPlugin(PapersPlugin):
for name, definition in conf['plugins']['alias'].items():
self.aliases.append(Alias.create_alias(name, definition))
def update_parser(self, subparsers):
def update_parser(self, subparsers, conf):
"""Add subcommand to the provided subparser"""
for alias in self.aliases:
alias_parser = alias.parser(subparsers)

View File

@ -80,7 +80,7 @@ def execute(raw_args=sys.argv):
# Extend with plugin commands
plugins.load_plugins(conf, ui)
for p in plugins.get_plugins().values():
p.update_parser(subparsers)
p.update_parser(subparsers, conf)
# Eventually autocomplete
autocomplete(parser)