Use voussoirkit.getpermission.

This commit is contained in:
Ethan Dalool 2020-03-07 13:52:29 -08:00
parent a73dbba387
commit 6c63444d27

View file

@ -10,6 +10,7 @@ import zipfile
import bs4 import bs4
import tinycss2 import tinycss2
from voussoirkit import getpermission
from voussoirkit import pathclass from voussoirkit import pathclass
HTML_LINK_PROPERTIES = { HTML_LINK_PROPERTIES = {
@ -1472,10 +1473,7 @@ def merge(
def merge_argparse(args): def merge_argparse(args):
if os.path.exists(args.output): if os.path.exists(args.output):
ok = args.autoyes if not (args.autoyes or getpermission.getpermission(f'Overwrite {args.output}?')):
if not ok:
ok = input(f'Overwrite {args.output}? y/n\n>').lower() in ('y', 'yes')
if not ok:
raise ValueError(f'{args.output} exists.') raise ValueError(f'{args.output} exists.')
return merge( return merge(