Skip to content

Commit

Permalink
Merge pull request #24 from IBM-Cloud/monitor_support
Browse files Browse the repository at this point in the history
Adding monitor support
  • Loading branch information
ullumullu authored May 20, 2020
2 parents 3834b0c + 8d6adcd commit 81fd562
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions redli.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ func main() {

if *commandargs != nil {
command := *commandargs

catchMonitorCmd(command[0])

var args = make([]interface{}, len(command[1:]))
for i, d := range command[1:] {
args[i] = d
Expand Down Expand Up @@ -320,12 +323,24 @@ func main() {
args[i] = d
}

catchMonitorCmd(parts[0])

result, err := conn.Do(parts[0], args...)

printRedisResult(result, forceraw)
}
}

func catchMonitorCmd(command string) {
if strings.ToLower(command) == "monitor" {
conn.Do("monitor")
for {
line, _ := redis.String(conn.Receive())
fmt.Printf("%s\n", line)
}
}
}

func printRedisResult(result interface{}, forceraw bool) {
printRedisResultIndenting(result, "", forceraw)
}
Expand Down

0 comments on commit 81fd562

Please sign in to comment.