You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
943 B

from .. import repo
from .. import color
from ..configs import config
from ..uis import get_ui
def parser(subparsers):
parser = subparsers.add_parser('remove', help='removes a paper')
parser.add_argument('-f', '--force', action='store_true', default=None,
help="does not prompt for confirmation.")
parser.add_argument('citekeys', nargs='*',
help="one or several citekeys")
return parser
def command(args):
ui = get_ui()
force = args.force
rp = repo.Repository(config())
if force is None:
are_you_sure = (("Are you sure you want to delete paper(s) [{}]"
" (this will also delete associated documents)?")
.format(', '.join([color.dye(c, color.citekey) for c in args.citekeys])))
sure = ui.input_yn(question=are_you_sure, default='n')
if force or sure:
for c in args.citekeys:
rp.remove_paper(c)