Skip to content

Commit 66c0472

Browse files
committed
Cli, add main pkg cli
1 parent f8f7c9a commit 66c0472

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

protobuf_to_pydantic/__main__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env python
2+
import logging
3+
4+
from protobuf_to_pydantic.cli import p2p_cli
5+
6+
logger = logging.getLogger(__name__)
7+
8+
9+
def main() -> None:
10+
p2p_cli(include_executable=False, include_sys_path=False)
11+
12+
13+
if __name__ == "__main__":
14+
main()

protobuf_to_pydantic/plugin/cli.py renamed to protobuf_to_pydantic/cli.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from protobuf_to_pydantic.__version__ import __version__
55

66

7-
def p2p_cli() -> None:
7+
def p2p_cli(include_sys_path: bool = True, include_executable: bool = True) -> None:
88
if not len(sys.argv) > 1:
99
return
1010
if "-V" in sys.argv or "--version" in sys.argv:
@@ -44,8 +44,10 @@ def p2p_cli() -> None:
4444
print()
4545
print()
4646
print("current working directory: " + os.getcwd())
47-
print("sys path: " + "\n -".join([""] + sys.path))
48-
print("executable: " + str(sys.executable))
47+
if include_sys_path:
48+
print("sys path: " + "\n -".join([""] + sys.path))
49+
if include_executable:
50+
print("executable: " + str(sys.executable))
4951
print("python version: " + str(sys.version_info))
5052
print()
5153
print("############# dependencies ############## ")

protobuf_to_pydantic/plugin/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
import logging
33

4-
from protobuf_to_pydantic.plugin.cli import p2p_cli
4+
from protobuf_to_pydantic.cli import p2p_cli
55
from protobuf_to_pydantic.plugin.code_gen import CodeGen
66
from protobuf_to_pydantic.plugin.config import ConfigModel
77

0 commit comments

Comments
 (0)