docs(clew): move command details into help

This commit is contained in:
2026-09-07 14:12:11 -04:00
parent 311030279f
commit e99269bb48
2 changed files with 25 additions and 52 deletions

View File

@@ -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.

View File

@@ -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)