2015-01-02 17:07:30 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-02-15 21:19:08 +00:00
|
|
|
"github.com/dballard/warren/cmd/warrend/conf"
|
2015-01-02 17:07:30 +00:00
|
|
|
"github.com/dballard/warren/lib/warren"
|
|
|
|
"net"
|
|
|
|
)
|
|
|
|
|
2015-04-07 04:29:04 +00:00
|
|
|
var listUsage = `
|
|
|
|
list -
|
2015-01-02 17:07:30 +00:00
|
|
|
`
|
|
|
|
|
2015-04-07 04:29:04 +00:00
|
|
|
var listCmd = &SockCommand{
|
2015-01-02 17:07:30 +00:00
|
|
|
Command: warren.Command{
|
2015-04-07 04:29:04 +00:00
|
|
|
Name: "list",
|
|
|
|
Usage: listUsage,
|
|
|
|
Summary: "Print list of warren deployments",
|
2015-01-02 17:07:30 +00:00
|
|
|
},
|
2015-04-07 04:29:04 +00:00
|
|
|
Run: listRun,
|
2015-01-02 17:07:30 +00:00
|
|
|
}
|
|
|
|
|
2015-04-07 04:29:04 +00:00
|
|
|
func listRun(cmd *SockCommand, c net.Conn, path string, args ...string) {
|
2015-01-28 06:20:39 +00:00
|
|
|
if len(args) > 0 && args[0] == "help" {
|
2015-02-22 01:29:46 +00:00
|
|
|
warren.WriteStringz(c, cmd.Usage)
|
2015-01-02 17:07:30 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2015-04-07 04:29:04 +00:00
|
|
|
warren.WriteStringz(c, "List\n")
|
2015-02-14 19:42:02 +00:00
|
|
|
|
2015-02-15 21:19:08 +00:00
|
|
|
for n, p := range conf.GetConf().Deployments {
|
2015-02-22 02:43:52 +00:00
|
|
|
warren.WriteStringz(c, n+": "+p+"\n")
|
2015-02-14 19:42:02 +00:00
|
|
|
}
|
|
|
|
|
2015-01-02 17:07:30 +00:00
|
|
|
}
|