rename status -> list. add pool cmd stub

This commit is contained in:
Dan Ballard 2015-04-06 21:29:04 -07:00
parent 42960560f3
commit 5d1d80310e
4 changed files with 28 additions and 17 deletions

View File

@ -27,16 +27,26 @@ var unregCmd = &warren.Command{
Run: warrendRun,
}
var statusUsage = `
warren status - Get the status from the warrend server
var listUsage = `
warren list - Get the status from the warrend server
`
var statusCmd = &warren.Command{
Name: "status",
Usage: statusUsage,
Summary: "Get the status from the warrend server",
var listCmd = &warren.Command{
Name: "list",
Usage: listUsage,
Summary: "Get a list of deployments from the warrend server",
Run: warrendRun,
}
var poolUsage = `
warren pool - Get/set the pool range for a deployment
`
var poolCmd = &warren.Command{
Name: "pool",
Usage: poolUsage,
Summary: "warren pool - Get/set the pool range for a deployment",
Run: warrendRun,
}
func warrendRun(cmd *warren.Command, args ...string) {
s, err := net.Dial(warren.CmdSockType, warren.CmdSockAddr)

View File

@ -25,9 +25,10 @@ func usage() {
func main() {
warren.RegisterCommand(buildCmd)
warren.RegisterCommand(deployCmd)
warren.RegisterCommand(statusCmd)
warren.RegisterCommand(listCmd)
warren.RegisterCommand(regCmd)
warren.RegisterCommand(unregCmd)
warren.RegisterCommand(poolCmd)
warren.RegisterCommand(versionCmd)
args := os.Args[1:]
if len(args) == 0 || args[0] == "-h" {

View File

@ -6,26 +6,26 @@ import (
"net"
)
var statusUsage = `
status -
var listUsage = `
list -
`
var statusCmd = &SockCommand{
var listCmd = &SockCommand{
Command: warren.Command{
Name: "status",
Usage: statusUsage,
Summary: "Print status of warrend",
Name: "list",
Usage: listUsage,
Summary: "Print list of warren deployments",
},
Run: statusRun,
Run: listRun,
}
func statusRun(cmd *SockCommand, c net.Conn, path string, args ...string) {
func listRun(cmd *SockCommand, c net.Conn, path string, args ...string) {
if len(args) > 0 && args[0] == "help" {
warren.WriteStringz(c, cmd.Usage)
return
}
warren.WriteStringz(c, "Status\n")
warren.WriteStringz(c, "List\n")
for n, p := range conf.GetConf().Deployments {
warren.WriteStringz(c, n+": "+p+"\n")

View File

@ -130,7 +130,7 @@ func main() {
initRunning()
warren.RegisterCommand(statusCmd)
warren.RegisterCommand(listCmd)
warren.RegisterCommand(regCmd)
warren.RegisterCommand(unregCmd)