fixed bug in attach cmds
This commit is contained in:
parent
67abfdd97a
commit
9fe568805c
@ -2,14 +2,15 @@ from .. import repo
|
|||||||
from .. import color
|
from .. import color
|
||||||
from ..configs import config
|
from ..configs import config
|
||||||
from ..uis import get_ui
|
from ..uis import get_ui
|
||||||
|
from .. import content
|
||||||
|
|
||||||
def parser(subparsers):
|
def parser(subparsers):
|
||||||
parser = subparsers.add_parser('attach',
|
parser = subparsers.add_parser('attach',
|
||||||
help='attach a document to an existing paper')
|
help='attach a document to an existing paper')
|
||||||
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('-L', '--link', action='store_false', dest='copy', default=True,
|
||||||
help="don't copy document files (opposite of -c)")
|
help="don't copy document files, just create a link.")
|
||||||
parser.add_argument('citekey',
|
parser.add_argument('citekey',
|
||||||
help='citekey of the paper')
|
help='citekey of the paper')
|
||||||
parser.add_argument('document',
|
parser.add_argument('document',
|
||||||
@ -30,10 +31,10 @@ def command(args):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
document = args.document
|
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 args.copy:
|
||||||
if ui.input_yn('{} has been copied into pubs; should the original be removed?'.format(color.dye(document, color.bold))):
|
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)))
|
ui.print_('{} attached to {}'.format(color.dye(document, color.bold), color.dye(paper.citekey, color.citekey)))
|
||||||
|
|
||||||
except ValueError as v:
|
except ValueError as v:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user