diff --git a/src/tilemapper/README.md b/src/tilemapper/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/tilemapper/cli.py b/src/tilemapper/cli.py index 0b306bb..086c572 100644 --- a/src/tilemapper/cli.py +++ b/src/tilemapper/cli.py @@ -17,7 +17,10 @@ app_state = {} @app.callback(invoke_without_command=True) def main( ctx: typer.Context, - config_dir: Path = Path(__file__).parent.parent / "tilesets", + config_dir: Path = typer.Option( + default=Path(__file__).parent.parent / "tilesets", + help="The path containing tile sets to load." + ), verbose: bool = typer.Option(default=False, help="If True, increase verbosity of status messages."), ): app_state["tileset_manager"] = _tileset.TileSetManager(config_dir) @@ -33,12 +36,18 @@ def main( @app.command() def list(): + """ + List available tile sets. + """ manager = app_state["tileset_manager"] print("\n".join(manager.available)) @app.command() -def inspect(source: Path): +def inspect(source: Path = typer.Argument(help="The battle map text file to laod.")): + """ + Print information about the specified battle map text file. + """ manager = app_state["tileset_manager"] bmap = battlemap.BattleMap(name=source.name, source=source, tileset=manager.console_map) bmap.load() @@ -47,7 +56,14 @@ def inspect(source: Path): @app.command() -def render(source: Path, outfile: Path, tileset: str = typer.Option(help="The tile set to use.")): +def render( + source: Path = typer.Argument(help="The battle map text file to load."), + outfile: Path = typer.Argument(help="The file to create."), + tileset: str = typer.Option( + help="The name of the tile set to use (run mapper list to see what's available).")): + """ + Create a PNG image of a battle map using a tile set. + """ manager = app_state["tileset_manager"] if tileset not in manager.available: raise RuntimeError(f"Could not locate the tile set {tileset} in {manager.config_dir}.") @@ -65,7 +81,7 @@ def render(source: Path, outfile: Path, tileset: str = typer.Option(help="The ti sys.exit(1) image = bmap.render() - # image = image.resize((int(0.5 * image.size[0]), int(0.5 * image.size[1]))) + image = image.resize((int(0.5 * image.size[0]), int(0.5 * image.size[1]))) image.save(outfile) print(f"Wrote {outfile.stat().st_size} bytes to {outfile}")