43 lines
794 B
Go
43 lines
794 B
Go
package main
|
|
|
|
import (
|
|
//"github.com/dballard/warren/cmd/warrend/conf"
|
|
"github.com/dballard/warren/lib/warren"
|
|
"bufio"
|
|
"strings"
|
|
)
|
|
|
|
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] == "help" {
|
|
writer.WriteString(cmd.Usage)
|
|
return
|
|
}
|
|
|
|
// GET
|
|
if len(args) == 1 {
|
|
writer.WriteString("Pool GET " + strings.Join(args, ", ") + "\n")
|
|
return
|
|
}
|
|
if len(args) == 3 {
|
|
writer.WriteString("Pool SET\n")
|
|
return
|
|
}
|
|
writer.WriteString(cmd.Usage)
|
|
return
|
|
}
|