Add parsed command line argument stuff

This commit is contained in:
Christine Dodrill 2015-06-13 01:34:17 -07:00
parent caea06bacc
commit 8a7aa8c730
1 changed files with 13 additions and 2 deletions

View File

@ -1,11 +1,22 @@
import commandeer, rawsockets
import commandeer, sockets, redis
commandline:
option hostname, string, "hostname", "h"
option optPort, int, "port", "p"
option admin, bool, "admin", ""
exitoption "help", "h",
"Usage: redis-cli [--help|--hostname=<string>|--port=<int>|--admin]"
"Usage: redis-cli [--admin|--help|--hostname=<string>|--port=<int>]"
errormsg "Invalid options: please read help."
if hostname == nil:
hostname = "127.0.0.1"
if optPort == 0:
optPort = 6379
echo "hostname: ", hostname
echo "port: ", optPort
var conn = redis.open(hostname, optPort.Port)
conn.quit()