mirror of
https://github.com/venthur/blag.git
synced 2025-11-25 20:52:43 +00:00
Don't use internal templates anymore.
Blag will throw an error if a template is not found locally. The error message contains an explanation for the user on where to get the missing templates. Quickstart will generate templates for the user in the working directory. Updated tests appropriately.
This commit is contained in:
@@ -6,6 +6,10 @@
|
||||
from __future__ import annotations
|
||||
import configparser
|
||||
import argparse
|
||||
import shutil
|
||||
import os
|
||||
|
||||
import blag
|
||||
|
||||
|
||||
def get_input(question: str, default: str) -> str:
|
||||
@@ -33,6 +37,22 @@ def get_input(question: str, default: str) -> str:
|
||||
return reply
|
||||
|
||||
|
||||
def copy_templates() -> None:
|
||||
"""Copy templates into current directory.
|
||||
|
||||
It will not overwrite existing files.
|
||||
|
||||
"""
|
||||
print("Copying templates...")
|
||||
try:
|
||||
shutil.copytree(
|
||||
os.path.join(blag.__path__[0], 'templates'),
|
||||
'templates',
|
||||
)
|
||||
except FileExistsError:
|
||||
print("Templates already exist. Skipping.")
|
||||
|
||||
|
||||
def quickstart(args: argparse.Namespace | None) -> None:
|
||||
"""Quickstart.
|
||||
|
||||
@@ -71,3 +91,5 @@ def quickstart(args: argparse.Namespace | None) -> None:
|
||||
}
|
||||
with open('config.ini', 'w') as fh:
|
||||
config.write(fh)
|
||||
|
||||
copy_templates()
|
||||
|
||||
Reference in New Issue
Block a user