diff --git a/README.md b/README.md index 135d430..94d067c 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,12 @@ ## Usage +usage: `./main.py []` + +Example: + ```bash -(venv-310) [user@linux snoflake-stats]$ ./main.py +(venv-310) [user@linux snoflake-stats]$ ./main.py snowflake-proxy root_at_my_server ``` ## Example output diff --git a/main.py b/main.py index 2826b16..9eff0c6 100755 --- a/main.py +++ b/main.py @@ -2,12 +2,23 @@ from __future__ import annotations from typing import List from datetime import datetime +import sys import exec def main(): - log: str = docker_logs(container_name='snowflake-proxy', ssh_host='rootnas') + if len(sys.argv) < 2: + print(f'usage: {sys.argv[0]} []', file=sys.stderr) + exit(1) + + container_name = sys.argv[1] + + ssh_hostname = None + if len(sys.argv) > 2: + ssh_hostname = sys.argv[2] + + log: str = docker_logs(container_name, ssh_hostname) filtered: List[str] = [line for line in log.splitlines() if Throughput.PATTERN in line] # filtered = filtered_example()