add dialog to delete the original docfile if copied
This commit is contained in:
parent
540b2c3113
commit
2cabdf4703
@ -18,7 +18,7 @@ def parser(subparsers):
|
|||||||
default=None)
|
default=None)
|
||||||
parser.add_argument('-k', '--citekey', help='citekey associated with the paper;\nif not provided, one will be generated automatically.',
|
parser.add_argument('-k', '--citekey', help='citekey associated with the paper;\nif not provided, one will be generated automatically.',
|
||||||
default=None)
|
default=None)
|
||||||
parser.add_argument('-c', '--copy', action='store_true', default=None,
|
parser.add_argument('-c', '--copy', action='store_true', default=True,
|
||||||
help="copy document files into library directory (default)")
|
help="copy document files into library directory (default)")
|
||||||
parser.add_argument('-C', '--nocopy', action='store_false', dest='copy',
|
parser.add_argument('-C', '--nocopy', action='store_false', dest='copy',
|
||||||
help="don't copy document files (opposite of -c)")
|
help="don't copy document files (opposite of -c)")
|
||||||
@ -111,13 +111,15 @@ def command(args):
|
|||||||
ui.warning(('Skipping document file from bib file '
|
ui.warning(('Skipping document file from bib file '
|
||||||
'{}, using {} instead.').format(bib_docfile, docfile))
|
'{}, using {} instead.').format(bib_docfile, docfile))
|
||||||
|
|
||||||
|
|
||||||
# create the paper
|
# create the paper
|
||||||
|
|
||||||
try:
|
try:
|
||||||
rp.push_paper(p)
|
rp.push_paper(p)
|
||||||
if docfile is not None:
|
if docfile is not None:
|
||||||
rp.push_doc(p.citekey, docfile, copy=args.copy)
|
rp.push_doc(p.citekey, docfile, copy=args.copy)
|
||||||
|
if args.copy:
|
||||||
|
if ui.input_yn('The file {} has been copied to the pubs repository. Should the original be removed?'.format(docfile)):
|
||||||
|
content.remove_file(docfile)
|
||||||
except ValueError as v:
|
except ValueError as v:
|
||||||
ui.error(v.message)
|
ui.error(v.message)
|
||||||
ui.exit(1)
|
ui.exit(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user