warren run cmd removed, direct commands added
This commit is contained in:
parent
f1e64b1227
commit
822f8624bd
|
@ -1,50 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/dballard/warren/lib/warren"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
// "os/exec"
|
||||
// "time"
|
||||
)
|
||||
|
||||
var runUsage = `
|
||||
warren run - Interfaces with warrend to manage running instances
|
||||
`
|
||||
|
||||
var runCmd = &warren.Command{
|
||||
Name: "run",
|
||||
Usage: runUsage,
|
||||
Summary: "Interface to warrend to manage running instances",
|
||||
Help: runUsage,
|
||||
Run: runRun,
|
||||
}
|
||||
|
||||
func runRun(cmd *warren.Command, args ...string) {
|
||||
if len(args) == 0 || args[0] == "help" {
|
||||
fmt.Print(cmd.Help)
|
||||
return
|
||||
}
|
||||
|
||||
s, err := net.Dial(warren.CmdSockType, warren.CmdSockAddr)
|
||||
if s != nil {
|
||||
defer s.Close()
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatal("Error connecting to warrend:", err)
|
||||
}
|
||||
dir, _ := os.Getwd()
|
||||
// pwd|arg1 arg2 arg3 ....
|
||||
warren.WriteStringz(s, dir+"|"+strings.Join(args, "|"))
|
||||
|
||||
resp, err := warren.ReadStringz(s)
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Println(resp)
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/dballard/warren/lib/warren"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
// "os/exec"
|
||||
// "time"
|
||||
)
|
||||
|
||||
var regUsage = `
|
||||
warren reg - Register a deployment directory for running
|
||||
`
|
||||
var regCmd = &warren.Command{
|
||||
Name: "reg",
|
||||
Usage: regUsage,
|
||||
Summary: "Register a deployment directory for running",
|
||||
Help: regUsage,
|
||||
Run: warrendRun,
|
||||
}
|
||||
|
||||
var statusUsage = `
|
||||
warren status - Get the status from the warrend server
|
||||
`
|
||||
var statusCmd = &warren.Command{
|
||||
Name: "status",
|
||||
Usage: statusUsage,
|
||||
Summary: "Get the status from the warrend server",
|
||||
Help: statusUsage,
|
||||
Run: warrendRun,
|
||||
}
|
||||
|
||||
func warrendRun(cmd *warren.Command, args ...string) {
|
||||
|
||||
s, err := net.Dial(warren.CmdSockType, warren.CmdSockAddr)
|
||||
if s != nil {
|
||||
defer s.Close()
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatal("Error connecting to warrend:", err)
|
||||
}
|
||||
dir, _ := os.Getwd()
|
||||
// pwd|arg1 arg2 arg3 ....
|
||||
warren.WriteStringz(s, dir+"|"+cmd.Name+"|"+strings.Join(args, "|"))
|
||||
|
||||
resp, err := warren.ReadStringz(s)
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Println(resp)
|
||||
}
|
|
@ -25,7 +25,8 @@ func usage() {
|
|||
func main() {
|
||||
warren.RegisterCommand(buildCmd)
|
||||
warren.RegisterCommand(deployCmd)
|
||||
warren.RegisterCommand(runCmd)
|
||||
warren.RegisterCommand(statusCmd)
|
||||
warren.RegisterCommand(regCmd)
|
||||
warren.RegisterCommand(versionCmd)
|
||||
args := os.Args[1:]
|
||||
if len(args) == 0 || args[0] == "-h" {
|
||||
|
|
Loading…
Reference in New Issue