def generate_resources(resources, path):
if len(resources) > 1 and not os.path.isdir(path):
if os.path.exists(path):
sys.exit('%s needs to be a directory to create multiple '
'resource files' % click.format_filename(path))
os.mkdir(path)
for resource in resources:
if len(resources) > 1 or os.path.isdir(path):
resource_path = '%s/%s' % (path, resource)
else:
resource_path = path
if os.path.exists(resource_path) and not \
click.confirm('%s already exists. Do you want to overwrite it?' %
click.format_filename(resource_path)):
continue
shutil.copy('%s/resources/%s' % (paths.DATA, resource), path)
click.echo('Created %s at path %s' % (resource,
click.format_filename(path)))
评论列表
文章目录