Pass the config to plugins on parser modification to allow completion.
This commit is contained in:
parent
576d907a78
commit
e129398311
@ -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).
|
||||
"""
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user