-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrepl.py
22 lines (20 loc) · 848 Bytes
/
repl.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import argparse
import pprint
from client import Client
def main(host, port, verbose):
c = Client(host=host, port=port, verbose=verbose)
while True:
text = raw_input("sql> ").strip()
if text.lower() == "quit":
break
elif text:
result = c.query(text)
if result:
pprint.pprint(result)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Redis SQL client REPL.')
parser.add_argument('--host', dest='host', type=str, default='localhost', help='Redis host')
parser.add_argument('--port', dest='port', type=int, default=6379, help='Redis port')
parser.add_argument('--verbose', dest='verbose', action="store_true", help='Verbose tracing')
options = parser.parse_args()
main(options.host, options.port, options.verbose)