36 lines
733 B
Go
36 lines
733 B
Go
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")
|
|
}
|
|
}
|