Add option to enable writing to notes
This commit is contained in:
parent
a5910f50f3
commit
ca36cadb4a
1 changed files with 12 additions and 2 deletions
|
@ -45,13 +45,20 @@ class ExtractPlugin(PapersPlugin):
|
||||||
"""Allow the usage of the pubs git subcommand"""
|
"""Allow the usage of the pubs git subcommand"""
|
||||||
# TODO option for quiet/loud mode.
|
# TODO option for quiet/loud mode.
|
||||||
# TODO option for ignoring missing documents or erroring.
|
# TODO option for ignoring missing documents or erroring.
|
||||||
# TODO option for writing to stdout or notes
|
|
||||||
extract_parser = subparsers.add_parser(self.name, help=self.description)
|
extract_parser = subparsers.add_parser(self.name, help=self.description)
|
||||||
extract_parser.add_argument(
|
extract_parser.add_argument(
|
||||||
"citekeys",
|
"citekeys",
|
||||||
nargs=argparse.REMAINDER,
|
nargs=argparse.REMAINDER,
|
||||||
help="citekey(s) of the documents to extract from",
|
help="citekey(s) of the documents to extract from",
|
||||||
)
|
)
|
||||||
|
# TODO option for writing to stdout or notes
|
||||||
|
extract_parser.add_argument(
|
||||||
|
"-w",
|
||||||
|
"--write",
|
||||||
|
help="write to individual notes instead of standard out. CAREFUL: OVERWRITES NOTES CURRENTLY",
|
||||||
|
action='store_true',
|
||||||
|
default=None,
|
||||||
|
)
|
||||||
extract_parser.set_defaults(func=self.command)
|
extract_parser.set_defaults(func=self.command)
|
||||||
|
|
||||||
def command(self, conf, args):
|
def command(self, conf, args):
|
||||||
|
@ -63,6 +70,9 @@ class ExtractPlugin(PapersPlugin):
|
||||||
return
|
return
|
||||||
papers = self.gather_papers(citekeys)
|
papers = self.gather_papers(citekeys)
|
||||||
all_annotations = self.extract(papers)
|
all_annotations = self.extract(papers)
|
||||||
|
if args.write:
|
||||||
|
self.to_notes(conf, all_annotations, args.edit)
|
||||||
|
else:
|
||||||
self.to_stdout(all_annotations)
|
self.to_stdout(all_annotations)
|
||||||
|
|
||||||
def extract(self, papers):
|
def extract(self, papers):
|
||||||
|
|
Loading…
Reference in a new issue