CLI flush action

This commit is contained in:
2014-09-28 18:17:02 +04:00
parent 5f1ed72712
commit a79904ece6
2 changed files with 21 additions and 7 deletions
+13
View File
@@ -1,6 +1,7 @@
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
@@ -89,6 +90,18 @@ func main() {
}
},
},
{
Name: "flush",
Usage: "Flush all messages from given queues",
Action: func(c *cli.Context) {
if msgs := bsq.Flush(c.Args()...); msgs != nil {
jsn, _ := json.Marshal(msgs)
fmt.Println(string(jsn))
} else {
fmt.Printf("Failed to flush queues %s\n", strings.Join(c.Args(), ", "))
}
},
},
{
Name: "status",
Usage: "Show server status",