add password cmdline param

master
Jordan Orelli 11 years ago
parent 68045628a0
commit b855c321ac

@ -12,8 +12,9 @@ import (
)
var options struct {
host string
port int
host string
port int
password string
}
func usage(status int) {
@ -45,6 +46,10 @@ func main() {
}
defer conn.Close()
if options.password != "" {
fmt.Fprintf(conn, "*2\r\n$4\r\nauth\r\n$%d\r\n%s\r\n", len(options.password), options.password)
}
f, err := os.Open(fname)
if err != nil {
fmt.Printf("unable to open file %s: %v\n", fname, err)
@ -85,6 +90,7 @@ func main() {
func init() {
flag.StringVar(&options.host, "h", "127.0.0.1", "hostname")
flag.IntVar(&options.port, "p", 6379, "port")
flag.StringVar(&options.password, "a", "", "password")
}
/*

Loading…
Cancel
Save