diff --git a/src/clew/README.md b/src/clew/README.md index 4b75f3e..f2d13ac 100644 --- a/src/clew/README.md +++ b/src/clew/README.md @@ -2,55 +2,8 @@ Clew extracts Ren'Py game files for Ariadne. -## Usage - -Run Clew from the repository root: +Use `--help` for command documentation: ```sh -bazel run //src/clew -- \ - --game-root /path/to/game \ - --force +bazel run //src/clew -- --help ``` - -By default, Clew writes to `output/` at the repository root. -Use `--output-root` to choose another directory. - -```sh -bazel run //src/clew -- \ - --game-root /path/to/game \ - --output-root /tmp/clew-output \ - --force -``` - -Use `--suffix` to extract only selected archive paths. -Repeat the flag for multiple suffixes. - -```sh -bazel run //src/clew -- \ - --game-root /path/to/game \ - --suffix rpy \ - --suffix rpyc \ - --force -``` - -## Output - -Clew owns these directories under the output root: - -```text -output/ - source/ # copied loose and archived `.rpy` source files - work/ # extracted archives and copied compiled scripts - logs/ # run logs -``` - -Without `--force`, Clew refuses to run when one of those directories exists. -With `--force`, Clew deletes and recreates only those directories. - -## Current behavior - -Clew copies loose `.rpy` files into `source/`. -It copies loose `.rpyc` and `.rpymc` files into `work/compiled/`. -It extracts each `.rpa` archive into `work/archives/`. -It copies extracted `.rpy` files into `source/`. -It skips files under Ren'Py runtime directories. diff --git a/src/clew/clew.py b/src/clew/clew.py index 8d0ab00..c647e6d 100644 --- a/src/clew/clew.py +++ b/src/clew/clew.py @@ -1,6 +1,7 @@ from __future__ import annotations import argparse +import textwrap import logging import os import shutil @@ -16,7 +17,26 @@ MANAGED_DIRS = ("source", "work", "logs") def parse_args(argv: list[str]) -> argparse.Namespace: parser = argparse.ArgumentParser( prog="clew", - description="Prepare Ren'Py game artifacts for Ariadne.", + description="Extract Ren'Py game files for Ariadne.", + formatter_class=argparse.RawDescriptionHelpFormatter, + epilog=textwrap.dedent( + """\ + output layout: + output/ + source/ copied loose and archived .rpy source files + work/ extracted archives and copied compiled scripts + logs/ run logs + + behavior: + Clew copies loose .rpy files into source/. + Clew copies loose .rpyc and .rpymc files into work/compiled/. + Clew extracts each .rpa archive into work/archives/. + Clew copies extracted .rpy files into source/. + Clew skips files under Ren'Py runtime directories. + Without --force, Clew refuses to reuse managed output dirs. + With --force, Clew deletes only source/, work/, and logs/. + """ + ), ) parser.add_argument( "--game-root", @@ -28,7 +48,7 @@ def parse_args(argv: list[str]) -> argparse.Namespace: "--output-root", type=Path, default=default_output_root(), - help="Preparation output root.", + help="Preparation output root. Defaults to repository output/.", ) parser.add_argument( "--force", @@ -38,7 +58,7 @@ def parse_args(argv: list[str]) -> argparse.Namespace: parser.add_argument( "--suffix", action="append", - help="Extract only archive paths with this suffix.", + help="Extract only archive paths with this suffix. Repeatable.", ) return parser.parse_args(argv)