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"
|
2015-04-20 04:03:54 +00:00
|
|
|
"strconv"
|
|
|
|
"bufio"
|
|
|
|
"fmt"
|
2015-01-02 17:07:30 +00:00
|
|
|
)
|
|
|
|
|
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-20 04:03:54 +00:00
|
|
|
func listRun(cmd *SockCommand, writer *bufio.Writer, path string, args ...string) {
|
2015-01-28 06:20:39 +00:00
|
|
|
if len(args) > 0 && args[0] == "help" {
|
2015-04-20 04:03:54 +00:00
|
|
|
writer.WriteString(cmd.Usage)
|
2015-01-02 17:07:30 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2015-04-20 04:03:54 +00:00
|
|
|
writer.WriteString("List\n")
|
|
|
|
fmt.Print("List\n")
|
|
|
|
for name, dep := range conf.GetConf().Deployments {
|
|
|
|
writer.WriteString(name+" (ports " + strconv.Itoa(dep.Pool.Low) +":"+strconv.Itoa(dep.Pool.High)+") : "+dep.Path+"\n")
|
2015-02-14 19:42:02 +00:00
|
|
|
}
|
2015-01-02 17:07:30 +00:00
|
|
|
}
|