Pi66

Home | Repos | About | Blog | Gaza

merodi
A markdown-based static site generator.
git clone https://git.pi66.xyz/merodi

About | Files | Commits | Refs | License


main: add on_start/on_end lifecycle hooks

Author: pi66
Date: 2026-07-21 10:15
commit: 9d13b7a7

Stat

A src/main.py 7 +7 -0

Diff

diff --git a/src/main.py b/src/main.py
index 780d6fa..0a08d51 100755
--- a/src/main.py
+++ b/src/main.py
@@ -1,10 +1,12 @@
 import sys
 sys.dont_write_bytecode = True

+import atexit from argparse import ArgumentParser from os import environ from .log import * from . import settings +from .hooks import hook_call

def main(): common = ArgumentParser(add_help=False) @@ -33,6 +35,8 @@ def main(): settings.VERBOSE = args.verbose or ( environ.get("VERBOSE") in ["true", "1"]) settings.NO_COLOR = args.no_color or ( environ.get("NO_COLOR") in ["true", "1"]) ...

Show all

diff --git a/src/main.py b/src/main.py
index 780d6fa..0a08d51 100755
--- a/src/main.py
+++ b/src/main.py
@@ -1,10 +1,12 @@
 import sys
 sys.dont_write_bytecode = True

+import atexit from argparse import ArgumentParser from os import environ from .log import * from . import settings +from .hooks import hook_call

def main(): common = ArgumentParser(add_help=False) @@ -33,6 +35,8 @@ def main(): settings.VERBOSE = args.verbose or ( environ.get("VERBOSE") in ["true", "1"]) settings.NO_COLOR = args.no_color or ( environ.get("NO_COLOR") in ["true", "1"])

+ hook_call("on_start") + if args.command == "init": from .init_project import init init(project_path = args.path) @@ -48,3 +52,6 @@ def main(): elif args.command == "watch": from .watcher import run_watcher run_watcher(args.path) + + atexit.register(lambda: hook_call("on_end")) +

// Created by Pi66

// Copyright ©Pi66 2026