package main import ( "github.com/dballard/warren/cmd/warrend/conf" "github.com/dballard/warren/lib/warren" "bufio" "strconv" ) var poolUsage = ` pool [NAME] [LOW HIGH] ` var poolCmd = &SockCommand{ Command: warren.Command{ Name: "pool", Usage: poolUsage, Summary: "Get/Set port pool range for deployment", }, Run: poolRun, } // pool [name] -- get // pool [name] [low] [high] -- set func poolRun(cmd *SockCommand, writer *bufio.Writer, path string, args ...string) { if len(args) == 0 || args[0] == "" || (len(args) > 0 && args[0] == "help") { writer.WriteString(cmd.Usage) return } // GET if len(args) == 1 { deployment := conf.GetConfFor(args[0]) writer.WriteString("Pool " + strconv.Itoa(deployment.Pool.Low) + " to " + strconv.Itoa(deployment.Pool.High)) return } if len(args) == 3 { writer.WriteString("Pool SET\n") return } writer.WriteString(cmd.Usage) return }