COSMIT
This commit is contained in:
parent
a65873a7e0
commit
6a26216c3e
@ -59,12 +59,12 @@ def parser(subparsers, conf):
|
|||||||
|
|
||||||
return doc_parser
|
return doc_parser
|
||||||
|
|
||||||
|
|
||||||
def command(conf, args):
|
def command(conf, args):
|
||||||
|
|
||||||
ui = get_ui()
|
ui = get_ui()
|
||||||
rp = repo.Repository(conf)
|
rp = repo.Repository(conf)
|
||||||
|
|
||||||
|
|
||||||
# print(args)
|
# print(args)
|
||||||
# ui.exit()
|
# ui.exit()
|
||||||
|
|
||||||
@ -73,8 +73,10 @@ def command(conf, args):
|
|||||||
paper = rp.pull_paper(citekey)
|
paper = rp.pull_paper(citekey)
|
||||||
|
|
||||||
if paper.docpath is not None and not args.force:
|
if paper.docpath is not None and not args.force:
|
||||||
msg = ("The publication {} has already the document {} assigned." + os.linesep +
|
msg = ("The publication {} has already the document {} assigned.{newline}Overwrite? "
|
||||||
"Overwrite? ").format(color.dye_out(paper.citekey, 'citekey'), color.dye_out(paper.docpath, 'filepath'))
|
).format(color.dye_out(paper.citekey, 'citekey'),
|
||||||
|
color.dye_out(paper.docpath, 'filepath'),
|
||||||
|
newline=os.linesep)
|
||||||
if not ui.input_yn(question=msg, default='n'):
|
if not ui.input_yn(question=msg, default='n'):
|
||||||
ui.exit(0)
|
ui.exit(0)
|
||||||
else:
|
else:
|
||||||
@ -144,13 +146,13 @@ def command(conf, args):
|
|||||||
|
|
||||||
if paper.docpath is None:
|
if paper.docpath is None:
|
||||||
ui.error('No document associated with the entry {}.'.format(
|
ui.error('No document associated with the entry {}.'.format(
|
||||||
color.dye_err(citekey, 'citekey')))
|
color.dye_err(citekey, 'citekey')))
|
||||||
ui.exit()
|
ui.exit()
|
||||||
|
|
||||||
if with_command is None:
|
if with_command is None:
|
||||||
with_command = conf['main']['open_cmd']
|
with_command = conf['main']['open_cmd']
|
||||||
if with_command is None: # default in conf have not been changed
|
if with_command is None: # default in conf have not been changed
|
||||||
pass # TODO platform specific
|
pass # TODO platform specific
|
||||||
|
|
||||||
try:
|
try:
|
||||||
docpath = content.system_path(rp.databroker.real_docpath(paper.docpath))
|
docpath = content.system_path(rp.databroker.real_docpath(paper.docpath))
|
||||||
|
@ -95,7 +95,6 @@ class TestFakeFs(fake_filesystem_unittest.TestCase):
|
|||||||
self.fs.CreateDirectory(self.rootpath)
|
self.fs.CreateDirectory(self.rootpath)
|
||||||
os.chdir(self.rootpath)
|
os.chdir(self.rootpath)
|
||||||
|
|
||||||
|
|
||||||
def reset_fs(self):
|
def reset_fs(self):
|
||||||
self._stubber.tearDown() # renew the filesystem
|
self._stubber.tearDown() # renew the filesystem
|
||||||
self.setUp()
|
self.setUp()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user