docs(clew): move command details into help
This commit is contained in:
@@ -2,55 +2,8 @@
|
|||||||
|
|
||||||
Clew extracts Ren'Py game files for Ariadne.
|
Clew extracts Ren'Py game files for Ariadne.
|
||||||
|
|
||||||
## Usage
|
Use `--help` for command documentation:
|
||||||
|
|
||||||
Run Clew from the repository root:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
bazel run //src/clew -- \
|
bazel run //src/clew -- --help
|
||||||
--game-root /path/to/game \
|
|
||||||
--force
|
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import textwrap
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
@@ -16,7 +17,26 @@ MANAGED_DIRS = ("source", "work", "logs")
|
|||||||
def parse_args(argv: list[str]) -> argparse.Namespace:
|
def parse_args(argv: list[str]) -> argparse.Namespace:
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog="clew",
|
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(
|
parser.add_argument(
|
||||||
"--game-root",
|
"--game-root",
|
||||||
@@ -28,7 +48,7 @@ def parse_args(argv: list[str]) -> argparse.Namespace:
|
|||||||
"--output-root",
|
"--output-root",
|
||||||
type=Path,
|
type=Path,
|
||||||
default=default_output_root(),
|
default=default_output_root(),
|
||||||
help="Preparation output root.",
|
help="Preparation output root. Defaults to repository output/.",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--force",
|
"--force",
|
||||||
@@ -38,7 +58,7 @@ def parse_args(argv: list[str]) -> argparse.Namespace:
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--suffix",
|
"--suffix",
|
||||||
action="append",
|
action="append",
|
||||||
help="Extract only archive paths with this suffix.",
|
help="Extract only archive paths with this suffix. Repeatable.",
|
||||||
)
|
)
|
||||||
return parser.parse_args(argv)
|
return parser.parse_args(argv)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user