Change back plugin.py to plugins.py + adapt PapersPlugin class protoype to command with args
This commit is contained in:
parent
31cf4de9d3
commit
4a91c4953c
@ -8,7 +8,7 @@ import collections
|
|||||||
from .ui import UI
|
from .ui import UI
|
||||||
from . import configs
|
from . import configs
|
||||||
from . import commands
|
from . import commands
|
||||||
from . import plugin
|
from . import plugins
|
||||||
|
|
||||||
cmds = collections.OrderedDict([
|
cmds = collections.OrderedDict([
|
||||||
('init', commands.init_cmd),
|
('init', commands.init_cmd),
|
||||||
@ -36,8 +36,8 @@ def execute(raw_args = sys.argv):
|
|||||||
ui = UI(config)
|
ui = UI(config)
|
||||||
|
|
||||||
# Extend with plugin commands
|
# Extend with plugin commands
|
||||||
plugin.load_plugins(ui, config.plugins.split())
|
plugins.load_plugins(ui, config.plugins.split())
|
||||||
for p in plugin.get_plugins().values():
|
for p in plugins.get_plugins().values():
|
||||||
cmds.update(collections.OrderedDict([(p.name, p)]))
|
cmds.update(collections.OrderedDict([(p.name, p)]))
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="research papers repository")
|
parser = argparse.ArgumentParser(description="research papers repository")
|
||||||
|
@ -32,10 +32,14 @@ class PapersPlugin(object):
|
|||||||
parser.add_argument('strings', nargs='*', help='the strings')
|
parser.add_argument('strings', nargs='*', help='the strings')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def command(self, ui, strings):
|
def command(self, args):
|
||||||
"""This function will be called with argument defined in the parser above
|
"""This function will be called with argument defined in the parser above
|
||||||
This is a basic example
|
This is a basic example
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
ui = args.ui
|
||||||
|
strings = args.strings
|
||||||
|
|
||||||
for s in strings:
|
for s in strings:
|
||||||
print(s)
|
print(s)
|
||||||
|
|
@ -5,7 +5,7 @@ import subprocess
|
|||||||
from ... import repo
|
from ... import repo
|
||||||
from ...configs import config
|
from ...configs import config
|
||||||
from ... import files
|
from ... import files
|
||||||
from ...plugin import PapersPlugin
|
from ...plugins import PapersPlugin
|
||||||
from ...commands.helpers import add_references_argument, parse_reference
|
from ...commands.helpers import add_references_argument, parse_reference
|
||||||
|
|
||||||
from ...events import RemoveEvent
|
from ...events import RemoveEvent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user