Make notebook name an argument instead of an option

This commit is contained in:
Gergely Polonkai 2015-02-13 23:11:38 +00:00
parent c67e6ebae4
commit c7473c58a7

View File

@ -3,7 +3,7 @@ from zim.command import Command
from zim.notebook import resolve_notebook, build_notebook from zim.notebook import resolve_notebook, build_notebook
usagehelp ='''\ usagehelp ='''\
usage: zim --plugin linklist [OPTIONS] usage: zim --plugin linklist [OPTIONS] <notebook>
--help, -h Print this help --help, -h Print this help
--notebook URI Set notebook to operate on --notebook URI Set notebook to operate on
@ -20,7 +20,6 @@ List all links throughout the pages
class LinkListCommand(Command): class LinkListCommand(Command):
options = ( options = (
('help', 'h', 'Print this help text and exit'), ('help', 'h', 'Print this help text and exit'),
('notebook=', '', 'Select a notebook'),
('existing-only', 'e', 'List only existing pages'), ('existing-only', 'e', 'List only existing pages'),
('missing-only', 'm', 'List only missing pages'), ('missing-only', 'm', 'List only missing pages'),
) )
@ -39,8 +38,8 @@ class LinkListCommand(Command):
return return
nbi = None nbi = None
if 'notebook' in self.opts: if len(self.args) > 0:
nbi = resolve_notebook(self.opts['notebook']) nbi = resolve_notebook(self.args[0])
if nbi == None: if nbi == None:
print("Notebook must be specified!") print("Notebook must be specified!")