cycls 0.0.2.80__py3-none-any.whl → 0.0.2.81__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cycls/chat.py CHANGED
@@ -85,9 +85,18 @@ def chat(url):
85
85
 
86
86
 
87
87
  def main():
88
- len(sys.argv) < 2 and (print("Usage: cycls chat <url|port>"), sys.exit(1))
88
+ if len(sys.argv) < 2:
89
+ print("Usage: cycls chat <url|port>")
90
+ sys.exit(1)
89
91
  arg = sys.argv[1]
90
- url = f"http://localhost:{arg}" if arg.isdigit() else arg
92
+ if arg.isdigit():
93
+ port = int(arg)
94
+ if not (1 <= port <= 65535):
95
+ print(f"Error: Invalid port {port}. Must be between 1 and 65535.")
96
+ sys.exit(1)
97
+ url = f"http://localhost:{port}"
98
+ else:
99
+ url = arg
91
100
  chat(url)
92
101
 
93
102