Skip to content

Commit 5fb9eec

Browse files
committed
Add reactpy rewrite-props <PATHS> CLI
1 parent 1c75675 commit 5fb9eec

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ license-files = { paths = ["LICENSE"] }
6060
[tool.hatch.envs.default]
6161
installer = "uv"
6262

63+
[project.scripts]
64+
reactpy = "reactpy._console.cli:entry_point"
65+
6366
[[tool.hatch.build.hooks.build-scripts.scripts]]
6467
# Note: `hatch` can't be called within `build-scripts` when installing packages in editable mode, so we have to write the commands long-form
6568
commands = [

src/reactpy/__main__.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/reactpy/_console/cli.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Entry point for the ReactPy CLI."""
2+
3+
import click
4+
5+
from reactpy._console.rewrite_props import rewrite_props
6+
7+
8+
@click.group()
9+
@click.version_option(package_name="reactpy")
10+
def entry_point() -> None:
11+
pass
12+
13+
14+
entry_point.add_command(rewrite_props)
15+
16+
17+
if __name__ == "__main__":
18+
entry_point()

src/reactpy/_console/rewrite_props.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
@click.command()
1919
@click.argument("paths", nargs=-1, type=click.Path(exists=True))
2020
def rewrite_props(paths: list[str]) -> None:
21-
"""Rewrite snake_case props to camelCase in the specified paths"""
21+
"""Rewrite snake_case props to camelCase within <PATHS>."""
2222
for p in map(Path, paths):
2323
# Process each file or recursively process each Python file in directories
2424
for f in [p] if p.is_file() else p.rglob("*.py"):

0 commit comments

Comments
 (0)