Skip to content

Commit 52a0b39

Browse files
committed
Update -m invocation
1 parent 9f406c6 commit 52a0b39

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

pyjsx/__main__.py

+2-20
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
1-
import sys
2-
from pathlib import Path
3-
4-
from pyjsx import transpile
5-
6-
7-
def transpile_file(f: Path) -> None:
8-
print("Transpiling", f) # noqa: T201
9-
source = f.read_text("utf-8")
10-
new_file = f.parent / f"{f.stem}_transpiled{f.suffix}"
11-
new_file.write_text(transpile(source))
1+
from pyjsx.cli import cli
122

133

144
if __name__ == "__main__":
15-
for p in sys.argv[1:]:
16-
path = Path(p)
17-
if not path.exists():
18-
continue
19-
if path.is_dir():
20-
for f in path.rglob("*.py"):
21-
transpile_file(f)
22-
else:
23-
transpile_file(path)
5+
cli()

pyjsx/cli.py

-3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,3 @@ def transpile_file(path: Path) -> int:
4848
path.with_suffix(".py").write_text(transpiled)
4949
return 1
5050

51-
52-
if __name__ == "__main__":
53-
cli()

0 commit comments

Comments
 (0)