summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvuko <vuko@hackerspace.pl>2020-11-01 15:31:09 +0100
committervuko <vuko@hackerspace.pl>2020-11-01 15:31:09 +0100
commit32565c9135290ea30c38dead06ba15fe8a92df11 (patch)
tree348b1132528d1a8c171680bda7a52c1043531491
parentf2dc2687552bb4516715d58e956ba1bcb7186c59 (diff)
downloadcheckinator-32565c9135290ea30c38dead06ba15fe8a92df11.tar.gz
checkinator-32565c9135290ea30c38dead06ba15fe8a92df11.tar.bz2
checkinator-32565c9135290ea30c38dead06ba15fe8a92df11.zip
update command line client
-rw-r--r--at/cmd.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/at/cmd.py b/at/cmd.py
index 4680d61..c3707ff 100644
--- a/at/cmd.py
+++ b/at/cmd.py
@@ -2,11 +2,11 @@ import argparse
from pathlib import Path
from at.dhcp import parse_isc_dhcpd_leases
from time import time
-parser = argparse.ArgumentParser()
-parser.add_argument("leases", type=Path, help="leases file")
-parser.add_argument("--timeout", type=int, default=None, help="timeout in minutes")
def list():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("leases", type=Path, help="leases file")
+ parser.add_argument("--timeout", type=int, default=None, help="timeout in minutes")
args = parser.parse_args()
with open(args.leases) as f:
@@ -25,7 +25,11 @@ def format_mac(raw: bytes) -> str:
return ':'.join(f'{b:02x}' for b in raw)
def tracker_list():
- with grpc.insecure_channel('unix:///tmp/checkinator.sock') as channel:
+ parser = argparse.ArgumentParser()
+ parser.add_argument("address", default='unix:///tmp/checkinator.sock', nargs='?', help="leases file")
+ parser.add_argument("--timeout", type=int, default=None, help="timeout in minutes")
+ args = parser.parse_args()
+ with grpc.insecure_channel(args.address) as channel:
stub = DhcpTrackerStub(channel)
response = stub.GetClients(ClientsRequest())
for client in response.clients: