1
0
mirror of https://github.com/venthur/blag.git synced 2025-11-25 20:52:43 +00:00

Improved the default theme.

Closes: #48
This commit is contained in:
Bastian Venthur
2023-06-13 16:29:44 +02:00
parent e1b1ebde32
commit fe268516e3
18 changed files with 515 additions and 43 deletions

View File

@@ -37,20 +37,25 @@ def get_input(question: str, default: str) -> str:
return reply
def copy_templates() -> None:
"""Copy templates into current directory.
def copy_default_theme() -> None:
"""Copy default theme into current directory.
The default theme contains the 'templates', 'content' and 'static'
directories shipped with blag.
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.")
print("Copying default theme...")
for dir_ in 'templates', 'content', 'static':
print(f" Copying {dir_}...")
try:
shutil.copytree(
os.path.join(blag.__path__[0], dir_),
dir_,
)
except FileExistsError:
print(f" {dir_} already exist. Skipping.")
def quickstart(args: argparse.Namespace | None) -> None:
@@ -92,4 +97,4 @@ def quickstart(args: argparse.Namespace | None) -> None:
with open('config.ini', 'w') as fh:
config.write(fh)
copy_templates()
copy_default_theme()