|
|
@ -10,6 +10,7 @@ def parser(subparsers, conf):
|
|
|
|
help='edit the note attached to a paper')
|
|
|
|
help='edit the note attached to a paper')
|
|
|
|
parser.add_argument('citekey', help='citekey of the paper',
|
|
|
|
parser.add_argument('citekey', help='citekey of the paper',
|
|
|
|
).completer = CiteKeyCompletion(conf)
|
|
|
|
).completer = CiteKeyCompletion(conf)
|
|
|
|
|
|
|
|
parser.add_argument('-a', '--append', help='append a line of text to the notes file', default=None)
|
|
|
|
return parser
|
|
|
|
return parser
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -18,7 +19,12 @@ def command(conf, args):
|
|
|
|
ui = get_ui()
|
|
|
|
ui = get_ui()
|
|
|
|
rp = repo.Repository(conf)
|
|
|
|
rp = repo.Repository(conf)
|
|
|
|
citekey = resolve_citekey(rp, args.citekey, ui=ui, exit_on_fail=True)
|
|
|
|
citekey = resolve_citekey(rp, args.citekey, ui=ui, exit_on_fail=True)
|
|
|
|
|
|
|
|
append = args.append
|
|
|
|
notepath = rp.databroker.real_notepath(citekey, rp.conf['main']['note_extension'])
|
|
|
|
notepath = rp.databroker.real_notepath(citekey, rp.conf['main']['note_extension'])
|
|
|
|
ui.edit_file(notepath, temporary=False)
|
|
|
|
if append is None:
|
|
|
|
|
|
|
|
ui.edit_file(notepath, temporary=False)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
with open(notepath, 'a') as fd:
|
|
|
|
|
|
|
|
fd.write(append)
|
|
|
|
NoteEvent(citekey).send()
|
|
|
|
NoteEvent(citekey).send()
|
|
|
|
rp.close()
|
|
|
|
rp.close()
|
|
|
|