Skip to content

Commit fedddd9

Browse files
committed
add protocol_gateway.py alias "ppg.py"
1 parent 6524bbf commit fedddd9

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ holding_registry.json
3131

3232
#ignore pypi / pyproject.toml output
3333
dist/*
34+
build/*
3435
python_protocol_gateway.egg-info/*

ppg.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#a little wrapper to create a shorthand alias
2+
import sys
3+
4+
from protocol_gateway import main
5+
6+
if __name__ == "__main__":
7+
# Pass sys.argv (or the relevant slice) to main()
8+
# assuming your main accepts them as parameters
9+
main(sys.argv[1:]) # pass all args except script name

protocol_gateway.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,17 +231,11 @@ def run(self):
231231

232232

233233

234-
def main():
234+
def main(args=None):
235235
"""
236236
main method
237237
"""
238-
print(__logo)
239-
240-
ppg = Protocol_Gateway(args.config)
241-
ppg.run()
242238

243-
244-
if __name__ == "__main__":
245239
# Create ArgumentParser object
246240
parser = argparse.ArgumentParser(description="Python Protocol Gateway")
247241

@@ -257,4 +251,11 @@ def main():
257251
# If '--config' is provided, use it; otherwise, fall back to the positional or default.
258252
args.config = args.config if args.config else args.positional_config
259253

254+
print(__logo)
255+
256+
ppg = Protocol_Gateway(args.config)
257+
ppg.run()
258+
259+
260+
if __name__ == "__main__":
260261
main()

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ authors = [{ name = "HotNoob", email = "hotnoob@hotnoob.com" }]
1616
requires-python = ">=3.9"
1717
dynamic = ["dependencies", "optional-dependencies"]
1818

19+
[project.scripts]
20+
protocol-gateway = "protocol_gateway:main"
21+
ppg = "protocol_gateway:main"
22+
1923
[tool.setuptools]
2024
py-modules = ["protocol_gateway"]
2125
license-files = ["LICENSE"]

0 commit comments

Comments
 (0)