From 9fe568805c64ab0d35a3250311bbe0dccb3ce411 Mon Sep 17 00:00:00 2001 From: Fabien Benureau Date: Sat, 24 Jan 2015 00:58:25 +0100 Subject: [PATCH] fixed bug in attach cmds --- pubs/commands/attach_cmd.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pubs/commands/attach_cmd.py b/pubs/commands/attach_cmd.py index d29eb7e..8bd5ebd 100644 --- a/pubs/commands/attach_cmd.py +++ b/pubs/commands/attach_cmd.py @@ -2,14 +2,15 @@ from .. import repo from .. import color from ..configs import config from ..uis import get_ui +from .. import content def parser(subparsers): parser = subparsers.add_parser('attach', help='attach a document to an existing paper') - parser.add_argument('-c', '--copy', action='store_true', default=None, - help="copy document files into library directory (default)") - parser.add_argument('-C', '--nocopy', action='store_false', dest='copy', - help="don't copy document files (opposite of -c)") + # parser.add_argument('-c', '--copy', action='store_true', default=True, + # help="copy document files into library directory (default)") + parser.add_argument('-L', '--link', action='store_false', dest='copy', default=True, + help="don't copy document files, just create a link.") parser.add_argument('citekey', help='citekey of the paper') parser.add_argument('document', @@ -30,10 +31,10 @@ def command(args): try: document = args.document - document = rp.push_doc(paper.citekey, document, copy=args.copy) + rp.push_doc(paper.citekey, document, copy=args.copy) if args.copy: if ui.input_yn('{} has been copied into pubs; should the original be removed?'.format(color.dye(document, color.bold))): - content.remove_file(docfile) + content.remove_file(document) ui.print_('{} attached to {}'.format(color.dye(document, color.bold), color.dye(paper.citekey, color.citekey))) except ValueError as v: