mirror of
https://codeberg.org/privacy1st/snowflake-stats
synced 2024-12-23 01:56:04 +01:00
parse arguments
This commit is contained in:
parent
3444639000
commit
82bb71a35a
@ -2,8 +2,12 @@
|
||||
|
||||
## Usage
|
||||
|
||||
usage: `./main.py <docker-container-name> [<ssh-hostname>]`
|
||||
|
||||
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
|
||||
|
13
main.py
13
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]} <docker-container-name> [<ssh-hostname>]', 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()
|
||||
|
Loading…
Reference in New Issue
Block a user