warren/cmd/warrend/cmd_list.go

37 lines
845 B
Go
Raw Normal View History

package main
import (
"github.com/dballard/warren/cmd/warrend/conf"
"github.com/dballard/warren/lib/warren"
"strconv"
"bufio"
"fmt"
)
var listUsage = `
list -
`
var listCmd = &SockCommand{
Command: warren.Command{
Name: "list",
Usage: listUsage,
Summary: "Print list of warren deployments",
},
Run: listRun,
}
func listRun(cmd *SockCommand, writer *bufio.Writer, path string, args ...string) {
if len(args) > 0 && args[0] == "help" {
writer.WriteString(cmd.Usage)
return
}
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")
fmt.Print(name+" (ports " + strconv.Itoa(dep.Pool.Low) +":"+strconv.Itoa(dep.Pool.High)+") : "+dep.Path+"\n")
2015-02-14 19:42:02 +00:00
}
}