diff --git a/src/zona/cli.py b/src/zona/cli.py index a211e1f..bbfc612 100644 --- a/src/zona/cli.py +++ b/src/zona/cli.py @@ -1,3 +1,4 @@ +from typing import Annotated import typer from pathlib import Path from zona import server @@ -11,20 +12,67 @@ setup_logging("DEBUG") @app.command() -def build(root: Path | None = None, output: Path | None = None): +def build( + root: Annotated[ + Path | None, + typer.Argument( + help="Directory containing config.yml", + ), + ] = None, + output: Annotated[ + Path | None, + typer.Argument(help="Location to write built website"), + ] = None, +): + """ + Build the website. + + Optionally specify the ROOT and OUTPUT directories. + """ builder = ZonaBuilder(root, output) builder.build() @app.command() -def serve(root: Path | None = None, output: Path | None = None): +def serve( + root: Annotated[ + Path | None, + typer.Argument( + help="Directory containing config.yml", + ), + ] = None, + output: Annotated[ + Path | None, + typer.Argument(help="Location to write built website"), + ] = None, +): + """ + Build the website and start a live preview server. + + The website is rebuilt when the source is modified. + + Optionally specify the ROOT and OUTPUT directories. + """ server.serve(root, output) @app.command() -def init(root: Path | None = None): - # init will populate the current directory with - # the required folders and their default values +def init( + root: Annotated[ + Path | None, + typer.Argument( + help="Target directory to populate as a Zona project", + ), + ] = None, +): + """ + Initialize a Zona website project. + + The required directory structure is created, + and the default configuration file is included. + + Optionally specify the ROOT directory. + """ initialize_site(root)