zensical:feature - add version flag

This commit is contained in:
squidfunk
2025-11-05 09:43:20 +01:00
parent 535bccd0d1
commit 29dadfdd67
6 changed files with 25 additions and 15 deletions
+4 -6
View File
@@ -29,16 +29,17 @@ import shutil
import webbrowser
from click import ClickException
from zensical import build, serve
from zensical import build, serve, version
# ----------------------------------------------------------------------------
# Commands
# ----------------------------------------------------------------------------
@click.version_option(version=version(), message="%(version)s")
@click.group()
def cli():
"""Zensical"""
"""Zensical - A modern static site generator"""
@cli.command(name="build")
@@ -167,10 +168,7 @@ def new_project(directory: str | None, **kwargs):
os.makedirs(directory)
package_dir = os.path.dirname(os.path.abspath(__file__))
shutil.copy(
os.path.join(package_dir, "bootstrap/zensical.toml"),
directory
)
shutil.copy(os.path.join(package_dir, "bootstrap/zensical.toml"), directory)
shutil.copytree(
os.path.join(package_dir, "bootstrap/docs"),
os.path.join(directory, "docs"),
+6 -1
View File
@@ -35,6 +35,11 @@ def serve(config_file: str, dev_addr: str):
Builds and serves the project.
"""
def version() -> str:
"""
Returns the current version.
"""
# ----------------------------------------------------------------------------
__all__ = ["build", "serve"]
__all__ = ["build", "serve", "version"]