2015-06-13 08:34:17 +00:00
|
|
|
import commandeer, sockets, redis
|
2015-06-13 08:16:48 +00:00
|
|
|
|
|
|
|
commandline:
|
|
|
|
option hostname, string, "hostname", "h"
|
|
|
|
option optPort, int, "port", "p"
|
|
|
|
option admin, bool, "admin", ""
|
|
|
|
exitoption "help", "h",
|
2015-06-13 08:34:17 +00:00
|
|
|
"Usage: redis-cli [--admin|--help|--hostname=<string>|--port=<int>]"
|
2015-06-13 08:16:48 +00:00
|
|
|
errormsg "Invalid options: please read help."
|
|
|
|
|
2015-06-13 08:34:17 +00:00
|
|
|
if hostname == nil:
|
|
|
|
hostname = "127.0.0.1"
|
2015-06-13 08:16:48 +00:00
|
|
|
|
2015-06-13 08:34:17 +00:00
|
|
|
if optPort == 0:
|
|
|
|
optPort = 6379
|
|
|
|
|
2015-06-13 08:39:13 +00:00
|
|
|
if admin:
|
|
|
|
echo "Connecting with admin permissions"
|
|
|
|
|
2015-06-13 08:34:17 +00:00
|
|
|
echo "hostname: ", hostname
|
|
|
|
echo "port: ", optPort
|
|
|
|
|
|
|
|
var conn = redis.open(hostname, optPort.Port)
|
|
|
|
|
|
|
|
conn.quit()
|